From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796205302; b=fJRQQuf6AvD5VDATpztpQMD3lz1sAUpiPI7D2qSUZuOtb5ghNGuQpSNdDH/gln5eOV8L pNV0CPkHiWOx31KVBxMKY/aMLfDH0XglEuFpw+wPPeJh868i5y9iLK7XyjWjrTfPcrd5d VnWSXzOLhE0mKyVf6ZPUADnNAZ2o8r+axuvkX00k6U06bS1s7pGgCmr5D2WWwDMolqOXf U3D1x3Y6DuCrmPscd2Zu5gSAnYjMFeW6FX1C7xXR6yX2LkZ3bdeBMDMBrt4kuF2dweLCk y7wEth6rvY5ot/Nrz+wRdDPuOxkDIf0KZJgD5HoIm28gwcCU+aWuGJ8fNpimjPFrZDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796205302; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=jte/IcaDn/+8rgZYUB0jDy0efkmmQInBhUKAHLkK2+o=; b=MVwAPEkq7BSwY7XnMaFYavfKDOzmUQvcVC+Q+A4DmHZFVotMdPMKvQFW/Jik8JZE9FD7 blHcrE1IJ0eUAMuZXYLAUvn5xz4zTxtNpGHqAjCsKH99TOi4tlThj8LB8UPR44+AHS9y1 l3auKYfEFwMdVsJOyE2zxFwLmTU6PVG0cMhe3FahXEV8F5ZOGQrJq8dibnR3oSWLC9jol cSGqaQnAiLnxdGPbV1+p0kv02GieFicXrwBJbjCwwPX0MJwqWXluGCPZuEn4usFbXiBgH ktyQs4GlHC90q8zLVLtzaQMRR8O9q/RkgdxpS5jzQuxhf1w4DsjOa7Bb9cQlmv0qiDw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.remote-ip=209.85.128.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D076F606A6A1 for ; Wed, 2 Dec 2026 09:55:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D076F606A6A1 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4bb606491faso65964145e9.3 for ; Wed, 02 Dec 2026 01:55:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796205300; x=1796810100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=jte/IcaDn/+8rgZYUB0jDy0efkmmQInBhUKAHLkK2+o=; b=KSGqBPc5Fq9gfP/2V8NHee3pruW6e5n79r+d5ZYDRjr3MjAKRnZGzkG2x+Ln7yaE4k fWiy3vgTkKqBo42PkGdeZCY9QsALJV397SKE2zvh8j4Rg16gUxgEdoeF1sRNdHRA5XRl 4yiHcUnv0fhGJE1AjBa0YF+bnTkIImyodo9nGMc2y1pvHavRdKHQ1u+iAvgBnuFBJxLw zpeNsf8oIZSf6xZTuIO6CHxiwzRKElvNpBXYI53Fn5c5Il3E1VWmD4BgPlhN+yxHSU51 AS8RGzFg0J/2o2+eP+k3h32jtSNwa3XLQga5SJvcb1S9JefPjVuPafQX0imD8lMtkbXO okxg== X-Forwarded-Encrypted: i=1; AL+hErE82+37JTOybZUtf3oxu7m3hhiNHbgeiOvS7SPUu3w/lbEVtifsA/MGYnlKqKIpUfYT8zvrY1JTSZmLHa8=@vger.kernel.org X-Gm-Message-State: APuU4Z/refbjPOwKYOxt6Dl8XYRSREiADyI/PqUgxeB2tDFITxtZwDZg J+8+UTsM0ME2qquES1rd/IbUL0JXleRAYgTQRKE0Mtd+GLw+AbUBTAnn X-Gm-Gg: AZFdTZcJFj07o/DXidJexPbi00/2fxC3fUAOlUYCEiWBspfXfhYf+/W5DQJZOOc0Ai7 x+e+2tYKuPMBRCCNKebvpPFoM4vvT96M/ADu6u1WZYLlXOi3Gb8XJpFDci+7Ld7R+AsYjnS6MOq LOyGfaR3DjHWpQSS8ZZDzJk8BgECmimxFPI55CZeA4NsgHYE1CRidA8UyBGNrApv9fyt4rKxIv1 d9iqTu1SBSp98XwUclGlpHkAQ4sxc/1GTpobzmwSj7DdNKQYLjQm2u4fRLhdsS3jHyCbwRmR7vp 4e2q/+w4ViALI924b6XOa/ZnCvpxxXqrrTlSlAcoltDo1ffgK7MHvxkFUo2biZvPtRnSp5Z+/+5 AQgW7BPiNO9WXB40AlEgtza8bmbRJfdpWwDy4nYRaeyxgPeJUGpkUZth4t4As5TuqUvqGrwFTve 5OMPYzIoJBviOjUHKTmGTvdKxOJ8EkNJfe4OQtLKdL0XHhVTt7Xj187qOM6jy9/GwS78cA0UP+S NjX34p+xImLd2FRW9OWCXDEK66Op4a2js2rT/tY7ZzxsZVZlmFCghu2BJV+cAa5kSc+GAwgCntl VfRTCGaK16lDwglwJkYgj+t4Ey5DWPeT3BYhW70= X-Received: by 2002:a05:600c:4e0d:b0:4bb:5f07:10d7 with SMTP id 5b1f17b1804b1-4bb8882445cmr733098305e9.26.1796205300120; Wed, 02 Dec 2026 01:55:00 -0800 (PST) Received: from tiehlicka (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853b216esm1148433885e9.12.2026.12.02.01.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 01:54:59 -0800 (PST) From: Michal Hocko To: David Hildenbrand Cc: David Rientjes , Ben Gardon , Johannes Weiner , mhocko@suse.com, Andrew Morton , , LKML , Chris Mason Subject: [PATCH 06/10] mm, oom: check oom victims prior to numa placement Date: Wed, 2 Dec 2026 10:53:59 +0100 Message-ID: <20261202095450.296675-7-mhocko@kernel.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202095450.296675-1-mhocko@kernel.org> References: <20261202095450.296675-1-mhocko@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Michal Hocko oom_evaluate_task checks oom_cpuset_eligible before potential inflight oom victims. This allows to have several oom victims on disjunct numa domains but it also allows to unnecessarily kill more tasks than necessary. But if we have tasks that consume memory in multiple numa nodes (e.g. via vma memory policy) then we can bail too early: TaskA (nodemask=1, vma->mpol=0), TaskB (nodemask=1) OOM1(nodemask=0): TaskA killed OOM2(nodemask=1): TaskA invisble due to oom_cpuset_eligible but it will be freeing memopry from node=1 too. Check for existing oom victims before numa placement and bail out if there is any oom victim even if it could be in a different oom domain. This is a slow path and postponed OOM killing is almost always a better choice than killing that is too eager. Reported-by: Chris Mason Signed-off-by: Michal Hocko --- mm/oom_kill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 6dc9424e6a05..6ff1e93ec6e3 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -318,10 +318,6 @@ static int oom_evaluate_task(struct task_struct *task, void *arg) if (oom_unkillable_task(task)) goto next; - /* p may not have freeable memory in nodemask */ - if (!is_memcg_oom(oc) && !oom_cpuset_eligible(task, oc)) - goto next; - /* * This task already has access to memory reserves and is being killed. * Don't allow any other task to have access to the reserves unless @@ -334,6 +330,10 @@ static int oom_evaluate_task(struct task_struct *task, void *arg) goto abort; } + /* p may not have freeable memory in nodemask */ + if (!is_memcg_oom(oc) && !oom_cpuset_eligible(task, oc)) + goto next; + /* * If task is allocating a lot of memory and has been marked to be * killed first if it triggers an oom, then select it. -- 2.56.1