Skip to contentSkip to conversation

ksm support

PATCH New Izik Eidus 1 participant 1 message Oct 8, 2009

lore
Share & tools
lore

Izik Eidus

author
#0 lore raw

PATCH 1/1 ksm support

Attached patch add ksm support

(below is inline version)

From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001
From: Izik Eidus <[email protected]>
Date: Thu, 8 Oct 2009 16:31:18 +0200
Subject: [PATCH] qemu ksm support

call MADV_MERGEABLE on guest memory allocations.

---
 exec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
exec.c +3 -0
index d9be575..076d26b 100644
@@ -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;
 
Signature · 1 line
1.6.2.5
Quoted 1 line

From cd20e52d0542b5f8716333b8abfcb8112684502b Mon Sep 17 00:00:00 2001

From: Izik Eidus <[email protected]>
Date: Thu, 8 Oct 2009 16:31:18 +0200
Subject: [PATCH] qemu ksm support

call MADV_MERGEABLE on guest memory allocations.

---
 exec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
exec.c +3 -0
index d9be575..076d26b 100644
@@ -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;
 
Signature · 1 line
1.6.2.5