From patchwork Thu Oct 8 14:39:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Izik Eidus X-Patchwork-Id: 35447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2F2C5B7088 for ; Fri, 9 Oct 2009 01:36:11 +1100 (EST) Received: from localhost ([127.0.0.1]:53282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvu6C-0002PQ-7E for incoming@patchwork.ozlabs.org; Thu, 08 Oct 2009 10:36:08 -0400 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 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: qemu-devel@nongnu.org X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] ksm support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;