From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-218.mta1.migadu.com [95.215.58.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289F63BFE2D for ; Thu, 13 Aug 2026 09:38:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786613905; cv=none; b=QjLmCDJ5KA+/P2mSRqj1MrX2Z7MNERDHYnAE7LYgmZPo9EUUPq70r1TuF3KPzkY+gc4+6ODuJS9XX7nqgCEGEWwZbhoSIfmvm88d2m61cqC0iRAY/E+IkNmmbusALK8WTClvqpGKb0zAVpVLo+NABqWgQJR8BCVuU/rnJ2oacbk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786613905; c=relaxed/simple; bh=BlnwSR8qPlrA8mzIZnfJnVLPc/ljsBLrw0CyFU+bh7M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RY0pfEjQp+sjt2AVFhxx2vQp55gZ1dVaM46+NvYvHMwB4lJQk0o3NJHjKIyZowxbVKNhbEOXFOlCDOYVc0hfdtJfht52W6e86muRvX+arpxEW/sjI+St9ULj8R9eVMLviLUOLABdifzwzrpEACiEH8sF8iHUNWVP73eSR+M2wlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Thhb3rff; arc=none smtp.client-ip=95.215.58.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Thhb3rff" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=BlnwSR8qPlrA8mzIZnfJnVLPc/ljsBLrw0CyFU+bh7M=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1786613899; v=1; x=1787218699; b=Thhb3rffgTKVbEo2m6pz5yNOhsD7Uguk2bJ0FMkBW84/FEVlLqJ/frb0qiIslMLpxRWnnNWk LUosxkhN6+hTxWVnuoJkEafIx56xHgh02WwPr/C+Wzr4DEf7Bcx2Lchfzo0zkLB5TdMYdZKbKv9 zAsMYP2+NzunX+WkxsLrtcDU= X-Envelope-To: linux-kernel@vger.kernel.org Received: from localhost.localdomain (223.70.159.239) by smtp.migadu.com with ESMTPS id 36abd874b0a54fac; Thu, 13 Aug 2026 09:38:19 +0000 X-Migadu-Flow: FLOW_OUT From: Ye Liu To: Michal Hocko , Andrew Morton Cc: Ye Liu , David Rientjes , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/oom_kill: remove unreachable __GFP_THISNODE check in constrained_alloc() Date: Thu, 13 Aug 2026 17:38:09 +0800 Message-Id: <20260813093810.573302-1-ye.liu@linux.dev> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ye Liu 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 --- 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