On Mon, 2020-03-02 at 14:49 +0100, David Hildenbrand wrote:
> virtio-mem wants to allow to offline memory blocks of which some parts
> were unplugged (allocated via alloc_contig_range()), especially, to later
> offline and remove completely unplugged memory blocks. The important part
> is that PageOffline() has to remain set until the section is offline, so
> these pages will never get accessed (e.g., when dumping). The pages should
> not be handed back to the buddy (which would require clearing PageOffline()
> and result in issues if offlining fails and the pages are suddenly in the
> buddy).
> 
> Let's allow to do that by allowing to isolate any PageOffline() page
> when offlining. This way, we can reach the memory hotplug notifier
> MEM_GOING_OFFLINE, where the driver can signal that he is fine with
> offlining this page by dropping its reference count. PageOffline() pages
> with a reference count of 0 can then be skipped when offlining the
> pages (like if they were free, however they are not in the buddy).
> 
> Anybody who uses PageOffline() pages and does not agree to offline them
> (e.g., Hyper-V balloon, XEN balloon, VMWare balloon for 2MB pages) will not
> decrement the reference count and make offlining fail when trying to
> migrate such an unmovable page. So there should be no observable change.
> Same applies to balloon compaction users (movable PageOffline() pages), the
> pages will simply be migrated.
> 
> Note 1: If offlining fails, a driver has to increment the reference
>       count again in MEM_CANCEL_OFFLINE.
> 
> Note 2: A driver that makes use of this has to be aware that re-onlining
>       the memory block has to be handled by hooking into onlining code
>       (online_page_callback_t), resetting the page PageOffline() and
>       not giving them to the buddy.
> 
> Cc: Andrew Morton <[email protected]>
> Cc: Juergen Gross <[email protected]>
> Cc: Konrad Rzeszutek Wilk <[email protected]>
> Cc: Pavel Tatashin <[email protected]>
> Cc: Alexander Duyck <[email protected]>
> Cc: Vlastimil Babka <[email protected]>
> Cc: Johannes Weiner <[email protected]>
> Cc: Anthony Yznaga <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Oscar Salvador <[email protected]>
> Cc: Mel Gorman <[email protected]>
> Cc: Mike Rapoport <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Anshuman Khandual <[email protected]>
> Cc: Qian Cai <[email protected]>
> Cc: Pingfan Liu <[email protected]>
> Signed-off-by: David Hildenbrand <[email protected]>

This addresses the core concerns I had with the patch.

Reviewed-by: Alexander Duyck <[email protected]>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to