[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 2/3] memory: add RAM_MERGEABLE flag to RAMBlock
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [RFC 2/3] memory: add RAM_MERGEABLE flag to RAMBlock |
Date: |
Mon, 25 Jun 2012 13:55:31 -0300 |
Will be used by the next commit.
Signed-off-by: Luiz Capitulino <address@hidden>
---
cpu-all.h | 1 +
exec.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/cpu-all.h b/cpu-all.h
index 429c1c3..9a36f7e 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -469,6 +469,7 @@ extern ram_addr_t ram_size;
/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
#define RAM_PREALLOC_MASK (1 << 0)
+#define RAM_MERGEABLE (1 << 1)
typedef struct RAMBlock {
struct MemoryRegion *mr;
diff --git a/exec.c b/exec.c
index c003789..e29b27f 100644
--- a/exec.c
+++ b/exec.c
@@ -2535,6 +2535,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void
*host,
new_block->host = file_ram_alloc(new_block, size, mem_path);
if (!new_block->host) {
new_block->host = qemu_vmalloc(size);
+ new_block->flags |= RAM_MERGEABLE;
madvise_mergeable(new_block->host, size);
}
#else
@@ -2562,6 +2563,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void
*host,
new_block->host = qemu_vmalloc(size);
}
#endif
+ new_block->flags |= RAM_MERGEABLE;
madvise_mergeable(new_block->host, size);
}
}
@@ -2689,6 +2691,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
length, addr);
exit(1);
}
+ block->flags |= RAM_MERGEABLE;
madvise_mergeable(vaddr, length);
}
return;
--
1.7.10.2.565.gbd578b5
[Qemu-devel] [RFC 3/3] memory/qmp: add set-memory-merge command, Luiz Capitulino, 2012/06/25
[Qemu-devel] [RFC 2/3] memory: add RAM_MERGEABLE flag to RAMBlock,
Luiz Capitulino <=