qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [5874] Add virtio-balloon support


From: Anthony Liguori
Subject: Re: [Qemu-devel] [5874] Add virtio-balloon support
Date: Fri, 05 Dec 2008 08:21:43 -0600
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Paul Brook wrote:
On Thursday 04 December 2008, Anthony Liguori wrote:
Hollis Blanchard wrote:
On Thu, 2008-12-04 at 20:33 +0000, Anthony Liguori wrote:
+static void balloon_page(void *addr, int deflate)
+{
+#if defined(__linux__)
+    if (!kvm_enabled() || kvm_has_sync_mmu())
+        madvise(addr, TARGET_PAGE_SIZE,
+                deflate ? MADV_WILLNEED : MADV_DONTNEED);
+#endif
+}
Hmm, I just noticed this... we need to use VIRTIO_BALLOON_PFN_SHIFT like
Rusty did on the kernel side.

However, in general I'm not sure how this is supposed to work. Isn't it
true that madvise() is a no-op if 0 < length < getpagesize()? If so, how
should the guest know the chunk size needed on the host?
We need to pass multiple of TARGET_PAGE_SIZE to madvise()

You mean HOST_PAGE_SIZE?

I change my previous answer :-)

I think we should just pass addr and the appropriate size of the memory the guest is ballooning. Whether the host can handle it is up to it. Worst case scenario, madvise() returns an error and no harm is done.

Regards,

Anthony Liguori

My linux manpage says that the address must be page aligned.

Paul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]