Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Wang Wensheng <wsw9603@163.com>
Cc: vbabka@kernel.org, hannes@cmpxchg.org, surenb@google.com,
	brendan.jackman@linux.dev, ziy@nvidia.com,
	akpm@linux-foundation.org, chrisl@kernel.org, kasong@tencent.com,
	shikemeng@huaweicloud.com, nphamcs@gmail.com,
	baoquan.he@linux.dev, baohua@kernel.org, youngjun.park@lge.com,
	david@kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/2] mm/page_alloc: Move PF_MEMALLOC warning to nopage tag in the slowpath
Date: Thu, 3 Dec 2026 18:24:07 +0100	[thread overview]
Message-ID: <axGlt4RCRwaRDND0@tiehlicka> (raw)
In-Reply-To: <20261203142306.468748-3-wsw9603@163.com>

On Thu 03-12-26 22:23:06, Wang Wensheng wrote:
> It is not uncommon to enter __alloc_pages_slowpath() with both
> PF_MEMALLOC and __GFP_NOFAIL set during memory reclaim. The original
> warning was placed where an allocation attempt had failed, intended to
> alert about a potential silent stall: with PF_MEMALLOC, direct reclaim
> cannot be performed, while __GFP_NOFAIL forces the allocation to keep
> retrying.
> 
> Commit 903edea6c53f ("mm: warn about illegal __GFP_NOFAIL usage in
> a more appropriate location and manner") moved this warning to the
> very start of __alloc_pages_slowpath(), before any allocation attempt.
> This causes frequent false positives: PF_MEMALLOC allows allocations
> to ignore watermarks, and the fastpath only checks the low watermark,
> so the first allocation attempt inside the slowpath is likely to
> succeed.

So essentially you are telling that we shouldn't warn if the allocation
just manages to succeeds because there are memory reserves available.
While the intention of the code is to catch the unsupported GFP_NOFAIL
use from the allocation context. See the difference?

-- 
Michal Hocko
SUSE Labs


      reply	other threads:[~2026-12-03 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 14:23 [PATCH 0/2] Fix spurious warnings about memory allocation Wang Wensheng
2026-12-03 14:23 ` [PATCH 1/2] mm/swap: Don't warn if swap_cluster_alloc_table() failed Wang Wensheng
2026-12-03 14:23 ` [PATCH 2/2] mm/page_alloc: Move PF_MEMALLOC warning to nopage tag in the slowpath Wang Wensheng
2026-12-03 17:24   ` Michal Hocko [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=axGlt4RCRwaRDND0@tiehlicka \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=brendan.jackman@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=wsw9603@163.com \
    --cc=youngjun.park@lge.com \
    --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