All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ye Liu <ye.liu@linux.dev>
To: Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: 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: [PATCH] mm/oom_kill: fix stale comment in constrained_alloc()
Date: Thu, 13 Aug 2026 11:06:54 +0800	[thread overview]
Message-ID: <20260813030654.320269-1-ye.liu@linux.dev> (raw)

From: Ye Liu <liuye@kylinos.cn>

The comment above the __GFP_THISNODE check in constrained_alloc()
is stale and inaccurate: it references __GFP_NOFAIL (which is not
checked here), claims the OOM killer does "random task kill" (it
uses badness scores), and mentions CONSTRAINT_THISNODE (which was
never added to the enum).  Replace it with a description that
matches the actual code behavior.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/oom_kill.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 5f372f6e26fa..4b5c70aaece4 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -268,9 +268,9 @@ 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.
+	 * __GFP_THISNODE means the allocation is restricted to a single node.
+	 * There is no dedicated constraint type for this case, so return
+	 * CONSTRAINT_NONE and let the normal OOM handling proceed.
 	 */
 	if (oc->gfp_mask & __GFP_THISNODE)
 		return CONSTRAINT_NONE;
-- 
2.25.1



             reply	other threads:[~2026-08-13  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  3:06 Ye Liu [this message]
2026-08-13  8:43 ` [PATCH] mm/oom_kill: fix stale comment in constrained_alloc() Michal Hocko
2026-08-13  9:50   ` Ye Liu

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=20260813030654.320269-1-ye.liu@linux.dev \
    --to=ye.liu@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuye@kylinos.cn \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=shakeel.butt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.