From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mvu27-0000k3-J9 for qemu-devel@nongnu.org; Thu, 08 Oct 2009 10:31:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mvu23-0000i2-2l for qemu-devel@nongnu.org; Thu, 08 Oct 2009 10:31:55 -0400 Received: from [199.232.76.173] (port=35354 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvu23-0000hz-03 for qemu-devel@nongnu.org; Thu, 08 Oct 2009 10:31:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9016) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mvu22-0000WD-FX for qemu-devel@nongnu.org; Thu, 08 Oct 2009 10:31:50 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n98EVmlm003906 for ; Thu, 8 Oct 2009 10:31:49 -0400 Received: from [10.35.6.57] (vpn-6-57.tlv.redhat.com [10.35.6.57]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n98EViPe012894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 8 Oct 2009 10:31:47 -0400 Message-ID: <4ACDF9AB.6040600@redhat.com> Date: Thu, 08 Oct 2009 16:39:39 +0200 From: Izik Eidus MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060503010800090003040008" Subject: [Qemu-devel] [PATCH] ksm support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060503010800090003040008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Attached patch add ksm support (below is inline version) From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001 From: Izik Eidus Date: Thu, 8 Oct 2009 16:31:18 +0200 Subject: [PATCH] qemu ksm support call MADV_MERGEABLE on guest memory allocations. Signed-off-by: Izik Eidus --- exec.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index d9be575..076d26b 100644 --- a/exec.c +++ b/exec.c @@ -2412,6 +2412,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) new_block = qemu_malloc(sizeof(*new_block)); new_block->host = qemu_vmalloc(size); +#ifdef MADV_MERGEABLE + madvise(new_block->host, size, MADV_MERGEABLE); +#endif new_block->offset = last_ram_offset; new_block->length = size; -- 1.6.2.5 --------------060503010800090003040008 Content-Type: text/plain; name="0001-qemu-ksm-support.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-qemu-ksm-support.patch" >>From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001 From: Izik Eidus Date: Thu, 8 Oct 2009 16:31:18 +0200 Subject: [PATCH] qemu ksm support call MADV_MERGEABLE on guest memory allocations. Signed-off-by: Izik Eidus --- exec.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index d9be575..076d26b 100644 --- a/exec.c +++ b/exec.c @@ -2412,6 +2412,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) new_block = qemu_malloc(sizeof(*new_block)); new_block->host = qemu_vmalloc(size); +#ifdef MADV_MERGEABLE + madvise(new_block->host, size, MADV_MERGEABLE); +#endif new_block->offset = last_ram_offset; new_block->length = size; -- 1.6.2.5 --------------060503010800090003040008--