From nobody Sat Jul 25 01:38:04 2026 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8C7F351C30 for ; Tue, 21 Jul 2026 00:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.30.148.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784594732; cv=none; b=XJ1nbhion/znxUHpHnLhmqq4wKp7O77c5hT+KNGlNs2YEA3eM4lbE2OoiuABwxsV+HLb5Y/Pvrl9B7Q5cWBdoDNd2RK6IbuOBPuxXN58q5fmDTkwTaUKpU5B16Jf2gXL/Ad1Z9BoFDGMa/tYtN8Vj6ggCOelvIyCEbkIxFKRmXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784594732; c=relaxed/simple; bh=EcWGCi4PhffOgsHFc8Us4T8xXRjZlL7niiriyyXyoXI=; h=Message-ID:Date:Mime-Version:From:To:Cc:Subject:Content-Type; b=cPcJsUtxUTU7zeh5BMlWO+izcRgqH6uIynW3vuhNf4FvKdl8FuLb7IP5kKq9z2TkmhUJe5I0bIA3LdD4OIXBMaluPrnMUycUzN0BYKZ+O2SEiO4xVhlBTr6OQHmUVFXKeQ0Zpw7HOrUDWiJ23RqUzWhnpYMR+j5i6h2rPK0yskM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=160.30.148.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4h3zFM0Pngz8XrrZ; Tue, 21 Jul 2026 08:45:27 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl2.zte.com.cn with SMTP id 66L0jL4S040046; Tue, 21 Jul 2026 08:45:21 +0800 (+08) (envelope-from hu.shengming@zte.com.cn) Received: from mapi (xaxapp04[null]) by mapi (Zmail) with MAPI id mid32; Tue, 21 Jul 2026 08:45:22 +0800 (CST) X-Zmail-TransId: 2afb6a5ec12210e-88f0e X-Mailer: Zmail v1.0 Message-ID: <20260721084522552ZPa16p1SRj3PYat3sqxuN@zte.com.cn> Date: Tue, 21 Jul 2026 08:45:22 +0800 (CST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: , , Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIHYzXSBtbS9zbHViOiBwcmV2ZW50IHBmbWVtYWxsb2Mgb2JqZWN0cyBmcm9tIGVudGVyaW5nIHRoZSBiYXJu?= Content-Type: text/plain; charset="utf-8" X-MAIL: mse-fl2.zte.com.cn 66L0jL4S040046 X-TLS: YES X-ENVELOPE-SENDER: hu.shengming@zte.com.cn X-SOURCE-IP: 10.5.228.133 unknown Tue, 21 Jul 2026 08:45:27 +0800 X-CLEAN: YES X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6A5EC127.000/4h3zFM0Pngz8XrrZ Content-Transfer-Encoding: quoted-printable From: Shengming Hu kmem_cache_return_sheaf() may refill a partially consumed sheaf before placing it in the barn. Without an explicit restriction, this refill may draw objects from pfmemalloc slabs and consume emergency reserves. Add __GFP_NOMEMALLOC so that returned sheaves are refilled only from non-pfmemalloc slabs. Also add __GFP_NOWARN, as suggested by Hao Li, because this refill is a best-effort attempt and failure is acceptable. If the refill fails, flush and free the sheaf instead. Fixes: 3c1ea5c5019f ("slab: sheaf prefilling for guaranteed allocations") Cc: stable@vger.kernel.org Signed-off-by: Shengming Hu Reviewed-by: Hao Li Reviewed-by: Harry Yoo (Oracle) --- Changes in v3: - Replace =E2=80=9Cnormal memory=E2=80=9D with the more precise =E2=80=9Cno= n-pfmemalloc slabs=E2=80=9D, and add Fixes: and Cc: stable@vger.kernel.org, as suggested by Harry. - Link to v2: https://lore.kernel.org/all/20260720211127124sYtTNbvsxCXN9_pD= h-pwt@zte.com.cn/ Changes in v2: - Add __GFP_NOWARN as suggested by Hao. - Link to v1: https://lore.kernel.org/all/20260719113701797vZ3R8NxiqYt8dEfe= UxtON@zte.com.cn/ --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 53b4976d3831..357b7522c817 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5123,7 +5123,7 @@ void kmem_cache_return_sheaf(struct kmem_cache *s, gf= p_t gfp, * simply flush and free it. */ if (!barn || data_race(barn->nr_full) >=3D MAX_FULL_SHEAVES || - refill_sheaf(s, sheaf, gfp)) { + refill_sheaf(s, sheaf, gfp | __GFP_NOMEMALLOC | __GFP_NOWARN)) { sheaf_flush_unused(s, sheaf); free_empty_sheaf(s, sheaf); return; --=20 2.25.1