From nobody Sat Jul 25 21:59:21 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 B427517A300 for ; Mon, 13 Jul 2026 06:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783925525; cv=none; b=r1u85csVWiqdzAzfKO5OIVcIc6EfIUn5yBrgf8aRj3406U/cat6uJK8BpxZ7onaMXV5KR9QuCyw+xeMaENfixP2TtuvxdLnQtCFKseWhQQsr6JHG1L+SsNwPfB299RvOjH5fs71p7YPv7sMzMTZ/kCrQNhouiCujlefuoxYx6a8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783925525; c=relaxed/simple; bh=NtE8+VHE2C/kccyGR4Beu9aMbWI4IwPjXx48uIH9zx8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ioOTO3Uxf83pm3Kb34ddMi/pQHeN8iOIRaNUPA3jME5uMPFT4iud9nJ8lECVcz7A0SEtsfrHbtCaTw+woJpoIWX8ZcIMbTkv6bkLWzvJZvHsk+nUGusAMUEmq+aCYbJAxN8cBihYaDUCbE03INZQkaV172SLvh0XZsvKBCS3UFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 56671dea7e8711f1aa26b74ffac11d73-20260713 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:e885e6ee-1443-4082-ba71-e71559edb3bb,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:53571e9e5a5dcf0ab86fa7777c8f2dcf,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|136|850|865|898,TC:nil,Content:0|15| 50,EDM:-3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0 ,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 56671dea7e8711f1aa26b74ffac11d73-20260713 X-User: zenghongling@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 40432187; Mon, 13 Jul 2026 14:51:56 +0800 From: Hongling Zeng To: vbabka@kernel.org, harry@kernel.org, akpm@linux-foundation.org, hao.li@linux.dev, cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev, vdavydov.dev@gmail.com, davej@fedoraproject.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhongling0719@126.com, Hongling Zeng , Hyeonggon Kim Subject: [PATCH] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add Date: Mon, 13 Jul 2026 14:51:51 +0800 Message-Id: <20260713065151.149982-1-zenghongling@kylinos.cn> 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: quoted-printable Content-Type: text/plain; charset="utf-8" Add a comment to clarify why we don't call kobject_put() when kobject_init_and_add() fails in sysfs_slab_add(). Per commit 2420baa8e046 ("mm/slab: Allow cache creation to proceed even if sysfs registration fails"), sysfs failures are treated as non-fatal and the cache continues to be used. Calling kobject_put() would trigger slab_kmem_cache_release() which frees the entire cache structure, so we intentionally skip it. Suggested-by: Hyeonggon Kim Signed-off-by: Hongling Zeng --- mm/slub.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 9ec774dc7009..edc822d7d9ea 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -9690,6 +9690,11 @@ static int sysfs_slab_add(struct kmem_cache *s) =20 s->kobj.kset =3D kset; err =3D kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name); + /* + * Intentionally skip kobject_put(). See commit 2420baa8e046 + * ("mm/slab: Allow cache creation to proceed even if sysfs + * registration fails") + */ if (err) goto out; =20 --=20 2.25.1