public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Fix -mem-path with hugetlbfs
@ 2010-05-03 21:12 Marcelo Tosatti
  2010-05-05  8:53 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2010-05-03 21:12 UTC (permalink / raw)
  To: kvm


Avi, please apply to both master and uq/master.

---

Fallback to qemu_vmalloc in case file_ram_alloc fails.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/exec.c b/exec.c
index 467a0e7..7125a93 100644
--- a/exec.c
+++ b/exec.c
@@ -2821,8 +2821,12 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
     if (mem_path) {
 #if defined (__linux__) && !defined(TARGET_S390X)
         new_block->host = file_ram_alloc(size, mem_path);
-        if (!new_block->host)
-            exit(1);
+        if (!new_block->host) {
+            new_block->host = qemu_vmalloc(size);
+#ifdef MADV_MERGEABLE
+            madvise(new_block->host, size, MADV_MERGEABLE);
+#endif
+        }
 #else
         fprintf(stderr, "-mem-path option unsupported\n");
         exit(1);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-05  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 21:12 Fix -mem-path with hugetlbfs Marcelo Tosatti
2010-05-05  8:53 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox