From nobody Sun May 24 20:37:24 2026 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.34]) (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 C7EB63BB694 for ; Thu, 21 May 2026 11:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.30.148.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779364227; cv=none; b=XiWegLQdV8CpJbuAPJjmOPkhCBCqSR4idGSaV+aXLdECO9KhBqIbUXVzV2FxOf5d7AQ9oF+xPOv1g7hDAmfIjciwtwlFApwT0yUbbErB/y+5m/ZCqvKs5GX0JFE7Y2l3NumMhpHr1VtiyCRGuEYdLmPl6lanZ5nOnsXWr9tq13g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779364227; c=relaxed/simple; bh=0yq1BY51F4UeHq/mpzv7JlKRjJBHVIoGy1qAsHIQOAg=; h=Message-ID:Date:Mime-Version:From:To:Cc:Subject:Content-Type; b=eVObo0PndjWG/UTAdqy+A3LLgCfBaAzh/VXTU/4tNIf94BjvxNa0sW745NmLf7PAB07UV+oiB9W+rWpgLNp4yzn1N2bk1CFNsXq7YP+mtwLqpD41ZGeL/xiZRujLEuNCCl2Gu4TptJ7REvJFlyXYmSRbEUE8XQXJjIyKzYXpnwA= 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.34 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 4gLmtc5pfsz5BNS0; Thu, 21 May 2026 19:50:16 +0800 (CST) Received: from xaxapp05.zte.com.cn ([10.99.98.109]) by mse-fl2.zte.com.cn with SMTP id 64LBoCAH057581; Thu, 21 May 2026 19:50:12 +0800 (+08) (envelope-from hu.shengming@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid32; Thu, 21 May 2026 19:50:15 +0800 (CST) X-Zmail-TransId: 2afa6a0ef177b6a-aa43f X-Mailer: Zmail v1.0 Message-ID: <20260521195015105Y4zvKHj0TfPZEujixy9Vo@zte.com.cn> Date: Thu, 21 May 2026 19:50:15 +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?W1BBVENIXSBtbS9zbHViOiBmcmVlIHJldHVybmVkIHBmbWVtYWxsb2Mgc2hlYXZlcyB2aWEgZnJlZV9lbXB0eV9zaGVhZigp?= X-MAIL: mse-fl2.zte.com.cn 64LBoCAH057581 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: hu.shengming@zte.com.cn X-SPF: None X-SOURCE-IP: 10.5.228.133 unknown Thu, 21 May 2026 19:50:16 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6A0EF178.002/4gLmtc5pfsz5BNS0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shengming Hu Regular sized sheaves are allocated through alloc_empty_sheaf(), which sets __GFP_NO_OBJ_EXT. free_empty_sheaf() is the matching free helper for such sheaves. It marks kmalloc sheaves with an empty codetag before kfree(), avoiding the alloc_tag_sub() warning for intentionally missing object extensions. kmem_cache_return_sheaf() currently handles returned pfmemalloc sheaves in the same branch as oversize sheaves and uses kfree(). That is right for oversize sheaves, which are allocated directly with kzalloc_flex(), but it misses the matching free path for regular sized pfmemalloc sheaves that came from alloc_empty_sheaf(). Split the two cases. Keep plain kfree() for capacity-mismatched oversize sheaves, and use free_empty_sheaf() after flushing returned pfmemalloc regular sheaves. Fixes: <1ce20c2> ("slab: handle pfmemalloc slabs properly with sheaves") Signed-off-by: Shengming Hu --- mm/slub.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 04692a6f9128..a6b720fa79ad 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5094,13 +5094,18 @@ void kmem_cache_return_sheaf(struct kmem_cache *s, = gfp_t gfp, struct slub_percpu_sheaves *pcs; struct node_barn *barn; - if (unlikely((sheaf->capacity !=3D s->sheaf_capacity) - || sheaf->pfmemalloc)) { + if (unlikely(sheaf->capacity !=3D s->sheaf_capacity)) { sheaf_flush_unused(s, sheaf); kfree(sheaf); return; } + if (unlikely(sheaf->pfmemalloc)) { + sheaf_flush_unused(s, sheaf); + free_empty_sheaf(s, sheaf); + return; + } + local_lock(&s->cpu_sheaves->lock); pcs =3D this_cpu_ptr(s->cpu_sheaves); barn =3D get_barn(s); --=20 2.25.1