Re: [PATCHv2 6/7] x86/mm: Provide helpers for unaccepted memory

From: Dave Hansen
Date: Tue Jan 11 2022 - 15:02:04 EST


On 1/11/22 03:33, Kirill A. Shutemov wrote:
Core-mm requires few helpers to support unaccepted memory:

- accept_memory() checks the range of addresses against the bitmap and
accept memory if needed;

- maybe_set_page_offline() checks the bitmap and marks a page with
PageOffline() if memory acceptance required on the first
allocation of the page.

- accept_and_clear_page_offline() accepts memory for the page and clears
PageOffline().

...
+void accept_memory(phys_addr_t start, phys_addr_t end)
+{
+ unsigned long flags;
+ if (!boot_params.unaccepted_memory)
+ return;
+
+ spin_lock_irqsave(&unaccepted_memory_lock, flags);
+ __accept_memory(start, end);
+ spin_unlock_irqrestore(&unaccepted_memory_lock, flags);
+}

Not a big deal, but please cc me on all the patches in the series. This is called from the core mm patches which I wasn't cc'd on.

This also isn't obvious, but this introduces a new, global lock into the fast path of the page allocator and holds it for extended periods of time. It won't be taken any more once all memory is accepted, but you can sure bet that it will be noticeable until that happens.

*PLEASE* document this. It needs changelog and probably code comments.