From nobody Sat Jul 25 02:37:12 2026 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) (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 A63672F549C for ; Mon, 20 Jul 2026 13:11:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=183.62.165.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784553101; cv=none; b=E0H3yxiAG3m3maow1b1Xq1z07cj4ChApzs3dbqp+vdeWbpjheEUNZUXXJRRMC469rpWUen5o7h8jS9h02Itryqa8m2SmbRskHjoZR+A/A/3MSVWngrnepPwO66wV9nZDAJ+nYake7Lovsj9zNEV2umK4KcOAIuQQVk1mpI7K/Wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784553101; c=relaxed/simple; bh=Oz/6az9r3vLy71qyfu2Szt3l1zcXFDqTQY3+UCzZnGs=; h=Message-ID:Date:Mime-Version:From:To:Cc:Subject:Content-Type; b=JPCkmQa7FxMqh1asIGLtvWkciz9FFU36i0xrpDycsCeXogDEK1VkOhTyUdJ5B4D4GJKorNXBo4AlyHnhwFDmAkR5zTqeVXiCac/gyGgwVXxg2RvU4jlOP5yrZhoSM2Efu75URaE378CQbcNWwCoSlYY8qwYl+BYda43uVvPXags= 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=183.62.165.209 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-fl1.zte.com.cn (unknown [10.5.228.132]) (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 mxct.zte.com.cn (FangMail) with ESMTPS id 4h3grY2Nc5z55RJ3; Mon, 20 Jul 2026 21:11:25 +0800 (CST) Received: from xaxapp04.zte.com.cn ([10.99.98.157]) by mse-fl1.zte.com.cn with SMTP id 66KDBNxk039877; Mon, 20 Jul 2026 21:11:23 +0800 (+08) (envelope-from hu.shengming@zte.com.cn) Received: from mapi (xaxapp05[null]) by mapi (Zmail) with MAPI id mid32; Mon, 20 Jul 2026 21:11:27 +0800 (CST) X-Zmail-TransId: 2afc6a5e1e7f293-12308 X-Mailer: Zmail v1.0 Message-ID: <20260720211127124sYtTNbvsxCXN9_pDh-pwt@zte.com.cn> Date: Mon, 20 Jul 2026 21:11:27 +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?W1BBVENIIHYyXSBtbS9zbHViOiBwcmV2ZW50IHBmbWVtYWxsb2Mgb2JqZWN0cyBmcm9tIGVudGVyaW5nIHRoZSBiYXJuwqA=?= X-MAIL: mse-fl1.zte.com.cn 66KDBNxk039877 X-TLS: YES X-ENVELOPE-SENDER: hu.shengming@zte.com.cn X-SOURCE-IP: 10.5.228.132 unknown Mon, 20 Jul 2026 21:11:25 +0800 X-CLEAN: YES X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6A5E1E7D.000/4h3grY2Nc5z55RJ3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 normal memory. 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. Signed-off-by: Shengming Hu --- 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