From nobody Mon Apr 29 19:58:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488969459834352.5359104300246; Wed, 8 Mar 2017 02:37:39 -0800 (PST) Received: from localhost ([::1]:55460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clYyO-0002ZU-Dw for importer@patchew.org; Wed, 08 Mar 2017 05:37:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clVmm-0008As-0x for qemu-devel@nongnu.org; Wed, 08 Mar 2017 02:13:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clVmi-0000ZE-Uf for qemu-devel@nongnu.org; Wed, 08 Mar 2017 02:13:24 -0500 Received: from mga04.intel.com ([192.55.52.120]:6123) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clVmi-0000Xg-NE for qemu-devel@nongnu.org; Wed, 08 Mar 2017 02:13:20 -0500 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2017 23:13:18 -0800 Received: from yangzhon-virtual.bj.intel.com ([10.238.144.108]) by orsmga004.jf.intel.com with ESMTP; 07 Mar 2017 23:13:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,262,1486454400"; d="scan'208";a="65363346" From: Yang Zhong To: qemu-devel@nongnu.org Date: Wed, 8 Mar 2017 23:11:12 +0800 Message-Id: <1488985872-22447-1-git-send-email-yang.zhong@intel.com> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.120 X-Mailman-Approved-At: Wed, 08 Mar 2017 05:34:57 -0500 Subject: [Qemu-devel] [PATCH] memory: reduce heap Rss size around 3M X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , pbonzini@redhat.com, anthony.xu@intel.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since cpu-memory and memory have same address space,one malloced memory is enough. This patch will skip memory malloc for memory address space,which will reduce around 3M physical memory in heap. Signed-off-by: Yang Zhong Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/memory.c b/memory.c index 284894b..799ca4c 100644 --- a/memory.c +++ b/memory.c @@ -2422,8 +2422,10 @@ AddressSpace *address_space_init_shareable(MemoryReg= ion *root, const char *name) AddressSpace *as; =20 QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { - if (root =3D=3D as->root && as->malloced) { - as->ref_count++; + if (root =3D=3D as->root) { + if (as->malloced) { + as->ref_count++; + } return as; } } --=20 1.9.1