Re: [PATCHv12 1/9] mm: Add support for unaccepted memory

From: Borislav Petkov
Date: Wed May 31 2023 - 11:52:12 EST


On Fri, May 19, 2023 at 02:14:26AM +0300, Kirill A. Shutemov wrote:
> The patch implements #1 and #2 for now. #2 is the default. Some

s/This patch implements/Implement/

> workloads may want to use #1 with accept_memory=eager in kernel
> command line. #3 can be implemented later based on user's demands.

All this remaining text should not talk about what is being done
- that's in the diff - but why. Drop the "what" pls.

> Support of unaccepted memory requires a few changes in core-mm code:
>
> - memblock has to accept memory on allocation;
>
> - page allocator has to accept memory on the first allocation of the
> page;
>
> Memblock change is trivial.
>
> The page allocator is modified to accept pages. New memory gets accepted
> before putting pages on free lists. It is done lazily: only accept new
> pages when we run out of already accepted memory. The memory gets
> accepted until the high watermark is reached.
>
> EFI code will provide two helpers if the platform supports unaccepted
> memory:
>
> - accept_memory() makes a range of physical addresses accepted.
>
> - range_contains_unaccepted_memory() checks anything within the range
> of physical addresses requires acceptance.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Acked-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> # memblock
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> drivers/base/node.c | 7 ++
> fs/proc/meminfo.c | 5 ++
> include/linux/mm.h | 19 +++++
> include/linux/mmzone.h | 8 ++
> mm/memblock.c | 9 +++
> mm/mm_init.c | 7 ++
> mm/page_alloc.c | 173 +++++++++++++++++++++++++++++++++++++++++
> mm/vmstat.c | 3 +
> 8 files changed, 231 insertions(+)

Diff itself looks ok.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette