From nobody Sun Apr 28 19:22:44 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 1489556566447194.3792836894529; Tue, 14 Mar 2017 22:42:46 -0700 (PDT) Received: from localhost ([::1]:34760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1co1hq-0000dg-Dq for importer@patchew.org; Wed, 15 Mar 2017 01:42:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1co1hC-0000dU-8v for qemu-devel@nongnu.org; Wed, 15 Mar 2017 01:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1co1h9-0001RS-63 for qemu-devel@nongnu.org; Wed, 15 Mar 2017 01:42:02 -0400 Received: from mga01.intel.com ([192.55.52.88]:2593) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1co1h8-0001Oz-Rx for qemu-devel@nongnu.org; Wed, 15 Mar 2017 01:41:59 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2017 22:41:55 -0700 Received: from yangzhon-virtual.bj.intel.com ([10.238.144.108]) by orsmga003.jf.intel.com with ESMTP; 14 Mar 2017 22:41:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489556518; x=1521092518; h=from:to:cc:subject:date:message-id; bh=852b+NPM1ICxgWlPD+Z9RyfMqeX0XDAgyycfWkRCz3M=; b=cjgKKVwz6ea6zJ6feWvy+oEXdsNnP7gd+HBpfLvkVLt4sLIzEYxfkyKx zu22+muT1R2x/9zpQQDvJyBITWa6BQ==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,167,1486454400"; d="scan'208";a="944436890" From: Yang Zhong To: qemu-devel@nongnu.org Date: Wed, 15 Mar 2017 21:39:48 +0800 Message-Id: <1489585188-14504-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.88 Subject: [Qemu-devel] [PATCH v3] 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 --- memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 64b0a60..0003b1e 100644 --- a/memory.c +++ b/memory.c @@ -2422,7 +2422,7 @@ AddressSpace *address_space_init_shareable(MemoryRegi= on *root, const char *name) AddressSpace *as; =20 QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { - if (root =3D=3D as->root && as->malloced) { + if (root =3D=3D as->root && as =3D=3D &address_space_memory) { as->ref_count++; return as; } --=20 1.9.1