From: Michal Hocko <mhocko@suse.com>
To: Ye Liu <ye.liu@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ye Liu <liuye@kylinos.cn>, David Rientjes <rientjes@google.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/oom_kill: remove unreachable __GFP_THISNODE check in constrained_alloc()
Date: Thu, 13 Aug 2026 13:29:35 +0200 [thread overview]
Message-ID: <an2qn_0n9CcU9sJx@tiehlicka> (raw)
In-Reply-To: <20260813093810.573302-1-ye.liu@linux.dev>
On Thu 13-08-26 17:38:09, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
>
> The __GFP_THISNODE check in constrained_alloc() is dead code: global
> OOM is never triggered with __GFP_THISNODE (blocked in
> __alloc_pages_may_oom before out_of_memory() is called), and memcg OOM
> returns CONSTRAINT_MEMCG at the top of the function before reaching
> this point. Remove the check, its stale comment, and update the
> following comment that referenced __GFP_THISNODE.
>
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> ---
> v2:
> - Remove the dead code directly.
> - Link: https://lore.kernel.org/all/20260813030654.320269-1-ye.liu@linux.dev/
>
> mm/oom_kill.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 5f372f6e26fa..fd3c476846a3 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -267,18 +267,11 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc)
>
> if (!oc->zonelist)
> return CONSTRAINT_NONE;
> - /*
> - * Reach here only when __GFP_NOFAIL is used. So, we should avoid
> - * to kill current.We have to random task kill in this case.
> - * Hopefully, CONSTRAINT_THISNODE...but no way to handle it, now.
> - */
> - if (oc->gfp_mask & __GFP_THISNODE)
> - return CONSTRAINT_NONE;
>
> /*
> - * This is not a __GFP_THISNODE allocation, so a truncated nodemask in
> - * the page allocator means a mempolicy is in effect. Cpuset policy
> - * is enforced in get_page_from_freelist().
> + * A truncated nodemask in the page allocator means a mempolicy
> + * is in effect. Cpuset policy is enforced in
> + * get_page_from_freelist().
> */
> if (oc->nodemask &&
> !nodes_subset(node_states[N_MEMORY], *oc->nodemask)) {
> --
> 2.25.1
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2026-08-13 11:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 9:38 [PATCH v2] mm/oom_kill: remove unreachable __GFP_THISNODE check in constrained_alloc() Ye Liu
2026-08-13 11:29 ` 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=an2qn_0n9CcU9sJx@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=rientjes@google.com \
--cc=shakeel.butt@linux.dev \
--cc=ye.liu@linux.dev \
/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