From: Anthony Liguori <anthony@codemonkey.ws>
To: Paul Brook <paul@codesourcery.com>
Cc: Rusty Russell <rusty@ozlabs.au.ibm.com>,
qemu-devel@nongnu.org, Hollis Blanchard <hollisb@us.ibm.com>,
kvm-devel <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [5874] Add virtio-balloon support
Date: Fri, 05 Dec 2008 08:21:43 -0600 [thread overview]
Message-ID: <493938F7.7090602@codemonkey.ws> (raw)
In-Reply-To: <200812051414.38406.paul@codesourcery.com>
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
>
prev parent reply other threads:[~2008-12-05 14:21 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
2008-12-04 22:34 ` Anthony Liguori
2008-12-05 14:14 ` Paul Brook
2008-12-05 14:21 ` Anthony Liguori [this message]
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=493938F7.7090602@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=hollisb@us.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=paul@codesourcery.com \
--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).