Re: [PATCH 0/2] mm/page_alloc: fix lazy memory acceptance before watermarks are set

From: Gupta, Pankaj

Date: Fri Dec 04 2026 - 08:14:29 EST


Hi Kiryl,

Lazy memory acceptance should accept memory only when it is needed.
Since commit 800f1059c99e ("mm/page_alloc: fix memory accept before
watermarks gets initialized"), one MAX_PAGE_ORDER page is accepted on
every page allocation until the zone watermarks are set. On a 19 GiB
SEV-SNP guest this accepts about ~14 GiB during boot and hence reduce the
boot time.

Patch 1 renames cond_accept_memory() to accept_memory_to_wmark().

Patch 2 accepts memory before the watermarks are set only when an
allocation cannot be satisfied.

SEV-SNP guest with 19 GiB of memory, memory left unaccepted after boot,
before and after this change:

before after
4 vCPUs 3.1 GiB 14.7 GiB
64 vCPUs 2.8 GiB 13.9 GiB

This also reduces the boot time of the guest.
Numbers looks iffy to me.

The table puts the difference at 11.6 GiB with 4 vCPUs. At 4 MiB per
allocation, that is about 3000 page allocations before
init_per_zone_wmark_min(). Where do they come from?

You are right about the numbers. I rechecked my data and found that I used 'maxcpus=255' in QEMU for both runs (-smp 4 and -smp 64), so the number of 'possible CPUs' was the same in each case. So, the noticeable change in unaccepted memory, I see with 'possible maxcpus=255'.

I will run additional tests and send more detailed numbers. Also, I am working on a v2.

Thanks,

Pankaj