From: Vlastimil Babka <vbabka@suse.cz>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>,
David Hildenbrand <david@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Tom Lendacky <thomas.lendacky@amd.com>,
"Kalra, Ashish" <ashish.kalra@amd.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
linux-mm@kvack.org, linux-coco@lists.linux.dev,
linux-kernel@vger.kernel.org, Farrah Chen <farrah.chen@intel.com>
Subject: Re: [PATCH] mm/page_alloc: Fix memory accept before watermarks gets initialized
Date: Tue, 11 Mar 2025 21:15:16 +0100 [thread overview]
Message-ID: <12460463-a2c4-4d02-b3fd-42a490d500a9@suse.cz> (raw)
In-Reply-To: <20250310082855.2587122-1-kirill.shutemov@linux.intel.com>
On 3/10/25 09:28, Kirill A. Shutemov wrote:
> Watermarks are initialized during the postcore initcall. Until then, all
> watermarks are set to zero. This causes cond_accept_memory() to
> incorrectly skip memory acceptance because a watermark of 0 is always
> met.
>
> To ensure progress, accept one MAX_ORDER page if the watermark is zero.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Reported-and-tested-by: Farrah Chen <farrah.chen@intel.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/page_alloc.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 579789600a3c..4fe93029bcb6 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7004,7 +7004,7 @@ static inline bool has_unaccepted_memory(void)
>
> static bool cond_accept_memory(struct zone *zone, unsigned int order)
> {
> - long to_accept;
> + long to_accept, wmark;
> bool ret = false;
>
> if (!has_unaccepted_memory())
> @@ -7013,8 +7013,18 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order)
> if (list_empty(&zone->unaccepted_pages))
> return false;
>
> + wmark = promo_wmark_pages(zone);
> +
> + /*
> + * Watermarks have not been initialized yet.
> + *
> + * Accepting one MAX_ORDER page to ensure progress.
> + */
> + if (!wmark)
> + return try_to_accept_memory_one(zone);
> +
> /* How much to accept to get to promo watermark? */
> - to_accept = promo_wmark_pages(zone) -
> + to_accept = wmark -
> (zone_page_state(zone, NR_FREE_PAGES) -
> __zone_watermark_unusable_free(zone, order, 0) -
> zone_page_state(zone, NR_UNACCEPTED));
next prev parent reply other threads:[~2025-03-11 20:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 8:28 Kirill A. Shutemov
2025-03-10 11:37 ` Vlastimil Babka
2025-03-10 12:06 ` Kirill A. Shutemov
2025-03-11 20:15 ` Vlastimil Babka [this message]
2025-03-12 19:14 ` Gupta, Pankaj
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=12460463-a2c4-4d02-b3fd-42a490d500a9@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=ashish.kalra@amd.com \
--cc=david@redhat.com \
--cc=farrah.chen@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=rick.p.edgecombe@intel.com \
--cc=rppt@kernel.org \
--cc=thomas.lendacky@amd.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®