From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
To: Pankaj Gupta <pankaj.gupta@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Zi Yan <ziy@nvidia.com>, Tom Lendacky <thomas.lendacky@amd.com>,
Farrah Chen <farrah.chen@intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
pankaj.gupta.linux@gmail.com
Subject: Re: [PATCH 0/2] mm/page_alloc: fix lazy memory acceptance before watermarks are set
Date: Thu, 3 Dec 2026 18:28:39 -0800 [thread overview]
Message-ID: <axIk68m_nFeAKFij@shutemov.name> (raw)
In-Reply-To: <20261130172641.237214-1-pankaj.gupta@amd.com>
On Mon, Nov 30, 2026 at 11:26:39AM -0600, Pankaj Gupta wrote:
> 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?
I traced kmem:mm_page_alloc from boot on a KVM guest. I see a few hundred
page allocations before init_per_zone_wmark_min() with 4 vCPUs and about
1,500 with 64. With deferred struct page init, most of ZONE_NORMAL only
reaches the unaccepted list in page_alloc_init_late(), and after that
there are 72 allocations with 4 vCPUs and 592 with 64. That is 0.3 GiB
and 2.3 GiB at most.
The number of early allocations also grows several times from 4 to 64
vCPUs, but your numbers barely move.
Could you show where the memory gets accepted? nr_unaccepted at the point
init_per_zone_wmark_min() runs, on both kernels, would tell how much of
the difference comes from this path.
--
Kiryl Shutsemau / Kirill A. Shutemov
prev parent reply other threads:[~2026-12-04 2:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:26 Pankaj Gupta
2026-11-30 17:26 ` [PATCH 1/2] mm/page_alloc: rename cond_accept_memory() to accept_memory_to_wmark() Pankaj Gupta
2026-11-30 17:26 ` [PATCH 2/2] mm/page_alloc: do not accept memory proactively before watermarks are set Pankaj Gupta
2026-12-04 2:28 ` Kiryl Shutsemau (Meta) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axIk68m_nFeAKFij@shutemov.name \
--to=kas@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=farrah.chen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=pankaj.gupta.linux@gmail.com \
--cc=pankaj.gupta@amd.com \
--cc=surenb@google.com \
--cc=thomas.lendacky@amd.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®