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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to