qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Rusty Russell <rusty@ozlabs.au.ibm.com>, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [5874] Add virtio-balloon support
Date: Thu, 04 Dec 2008 15:34:50 -0600	[thread overview]
Message-ID: <1228426490.19459.44.camel@localhost.localdomain> (raw)
In-Reply-To: <E1L8Ksl-0007wr-3q@cvs.savannah.gnu.org>

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?

What happens when a guest tries to balloon 4K pages when it's backed on
the host by hugetlbfs? We can't even use getpagesize() there.

Maybe the virtio balloon interface needs to advertise a unit size from
the host, and use that size instead of alloc_page() in the guest?

-- 
Hollis Blanchard
IBM Linux Technology Center

  reply	other threads:[~2008-12-04 21:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04 20:33 [Qemu-devel] [5874] Add virtio-balloon support Anthony Liguori
2008-12-04 21:34 ` Hollis Blanchard [this message]
2008-12-04 22:34   ` Anthony Liguori
2008-12-05 14:14     ` Paul Brook
2008-12-05 14:21       ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228426490.19459.44.camel@localhost.localdomain \
    --to=hollisb@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@ozlabs.au.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).