All of lore.kernel.org
 help / color / mirror / Atom feed
From: Izik Eidus <ieidus@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] ksm support
Date: Thu, 08 Oct 2009 16:39:39 +0200	[thread overview]
Message-ID: <4ACDF9AB.6040600@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

Attached patch add ksm support

(below is inline version)

 From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001
From: Izik Eidus <ieidus@redhat.com>
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 <ieidus@redhat.com>
---
  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


[-- Attachment #2: 0001-qemu-ksm-support.patch --]
[-- Type: text/plain, Size: 768 bytes --]

>From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001
From: Izik Eidus <ieidus@redhat.com>
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 <ieidus@redhat.com>
---
 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


                 reply	other threads:[~2009-10-08 14:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ACDF9AB.6040600@redhat.com \
    --to=ieidus@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.