diff options
author | 2012-10-05 16:47:57 -0300 | |
---|---|---|
committer | 2013-01-18 21:02:09 -0600 | |
commit | 18fad4723e8c220c2825b9975e6c7913085336a2 (patch) | |
tree | bf1ff1088dffc88b6b90f55fa02482c3f70b7c46 | |
parent | migration: Fix madvise breakage if host and guest have different page sizes (diff) | |
download | qemu-kvm-18fad4723e8c220c2825b9975e6c7913085336a2.tar.gz qemu-kvm-18fad4723e8c220c2825b9975e6c7913085336a2.tar.bz2 qemu-kvm-18fad4723e8c220c2825b9975e6c7913085336a2.zip |
Call MADV_HUGEPAGE for guest RAM allocations
This makes it possible for QEMU to use transparent huge pages (THP)
when transparent_hugepage/enabled=madvise. Otherwise THP is only
used when it's enabled system wide.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ad0b5321f1f797274603ebbe20108b0750baee94)
-rw-r--r-- | exec.c | 1 | ||||
-rw-r--r-- | osdep.h | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -2571,6 +2571,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff); qemu_ram_setup_dump(new_block->host, size); + qemu_madvise(new_block->host, size, QEMU_MADV_HUGEPAGE); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); @@ -108,6 +108,11 @@ void qemu_vfree(void *ptr); #else #define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID #endif +#ifdef MADV_HUGEPAGE +#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE +#else +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID +#endif #elif defined(CONFIG_POSIX_MADVISE) |