File kvm-qemu-madvise-hugepages.patch of Package kvm

Index: qemu-kvm-0.15.0/exec.c
===================================================================
--- qemu-kvm-0.15.0.orig/exec.c
+++ qemu-kvm-0.15.0/exec.c
@@ -2942,6 +2942,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(Devic
                 new_block->host = qemu_vmalloc(size);
                 qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);
                 qemu_madvise(new_block->host, size, QEMU_MADV_DONTFORK);
+#ifdef MADV_HUGEPAGE
+                qemu_madvise(new_block->host, size, MADV_HUGEPAGE);
+#endif
             }
 #else
             fprintf(stderr, "-mem-path option unsupported\n");
@@ -2970,6 +2973,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(Devic
 #endif
             qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE);
             qemu_madvise(new_block->host, size, QEMU_MADV_DONTFORK);
+#ifdef MADV_HUGEPAGE
+            qemu_madvise(new_block->host, size, MADV_HUGEPAGE);
+#endif
         }
     }
     new_block->length = size;