Re: use of shrinker in virtio balloon free page hinting

From: David Hildenbrand
Date: Wed Jul 17 2019 - 07:32:18 EST

On 17.07.19 13:20, Michael S. Tsirkin wrote:
> Wei, others,
> ATM virtio_balloon_shrinker_scan will only get registered
> when deflate on oom feature bit is set.
> Not sure whether that's intentional. Assuming it is:
> virtio_balloon_shrinker_scan will try to locate and free
> pages that are processed by host.
> The above seems broken in several ways:
> - count ignores the free page list completely
> - if free pages are being reported, pages freed
> by shrinker will just get re-allocated again
> I was unable to make this part of code behave in any reasonable
> way - was shrinker usage tested? What's a good way to test that?
> Thanks!

Some companies are using deflate-on-oom for some kind of "auto
ballooning" approach, although I don't think it's a good idea.

In these scenarios, the total ramsize (cat /proc/meminfo) will not
change on inflation/deflation. So from a system POV, inflated memory is
simply allocated memory without affecting the total memory.

VMs will automatically "reclaim" inflated memory when they need it -
which is usually not what hypervisors want (especially when talking
about using ballooning for memory hotunplug).

So yes, it makes perfect sense that the shrinker is only registered for



David / dhildenb