On 29.12.22 06:31, Soichiro Ueda wrote:> Hi David.
>
>> How does this affect page migration / balloon compaction etc?
>
> I guess this patch doesn't affect balloon compaction. When allocating
> pages using alloc_pages(), it skips compaction by masking out
> __GFP_RECLAIM if the order is larger than 0.
>
> As for page migration, in the current implementation it migrate a
> 0-order page to another 0-order page. With this patch, it may migrate a
> high-order page to another same-order page.
>
> But I noticed that the migrated high-order page is handled as 0-order
> page in virtballoon_migratepage().
>
> > ??? balloon_page_insert(vb_dev_info, newpage);
>
Yes, I think suspected that it's broken.
We also might want to handle OOM accordingly by splitting the page and
retrying migration. Almost nothing should stop a balloon page from
getting migrated.
One thing to try is allocating a higher-order page and immediately
splitting it into base pages, and enqueuing base pages only. Only
inflation would be faster, because you could only deflate base pages.
> We should put the newpage into a page list of the corresponding order,
> like this.
>
> ??? balloon_page_enqueue(vb_dev_info, newpage, order);
>
> I'll fix it in the v2 patch.
Note that I have some more concerns:
* We might end up stealing all higher-order pages from the guest instead
of eating all of the "small" leftover pieces first. This might be
undesirable. We discussed this in the past in the context of hugepage
ballooning [not able to locate the abandoned patches quickly].
* PG_offline won't work as expected anymore and result in kdump reading
inflated memory, which is undesirable. One workaround would be setting
PG_offline on all base pages, but this needs some more thought.
* How are we handling a scenario where we are requested to deflate e.g.,
a single 4096 KiB page but we only have higher-order pages allocated?
I suspect you would over-deflate right now, which is undesirable.
--
Thanks,
David / dhildenb