Re: mmotm 2014-03-10-15-35 uploaded (virtio_balloon)
From: Rusty Russell
Date: Mon Mar 17 2014 - 00:41:03 EST
Josh Triplett <josh@xxxxxxxxxxxxxxxx> writes:
> On Tue, Mar 11, 2014 at 12:31:33PM -0700, Andrew Morton wrote:
> I'd love to do that, but as far as I can tell, VIRTIO_BALLOON has gone
> out of its way to support !CONFIG_BALLOON_COMPACTION.
>
> Could someone who works on VIRTIO_BALLOON provide some details here
> about the distinction?
Balloon gives pages back to the host. If you want to do compaction,
we'll try to help you, but it's independent.
The normal way to do this would be to put a dummy inline version of
balloon_page_enqueue etc in the header. If you look at how the virtio
balloon code looked before e22504296d4f64fbbbd741602ab47ee874649c18
you'll see what it should do, eg:
#ifndef CONFIG_BALLOON_COMPACTION
struct balloon_dev_info {
struct list_head pages; /* Pages enqueued & handled to Host */
};
static inline struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info)
{
struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY |
__GFP_NOMEMALLOC | __GFP_NOWARN)
if (page)
list_add(&page->lru, &b_dev_info->pages);
return page;
}
static inline struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
{
struct page *page;
page = list_first_entry(&b_dev_info->pages, struct page, lru);
list_del(&page->lru);
return page;
}
static inline void balloon_page_free(struct page *page)
{
__free_page(page);
}
#else
...
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/