From nobody Sat Jul 25 21:59:36 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 D10E8449985 for ; Mon, 13 Jul 2026 07:00:34 +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=1783926038; cv=none; b=KOR9aA+vD0GxYRgBPjGI6Yux8ViCaA/Syj4H67aeym6BDu06n+NWc4NKzDG4nDkeylx3W/Rscx89pFAbilA0uXnI2tDAF+HooUc8ANifUQD/qicCs6wZEpOUQ7W0HLlQCq628Z3TzamWH9ypxwu86eI5nzcZUP5mLO9QqW2nV28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783926038; c=relaxed/simple; bh=gu/56ZJKZeS2grRCP2lP2Tw0mxTlhzz0McgcorfGPGM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FzIw/QDUUwYvWJLYqyI5eaXORTGAKQ4q34aJ8NyI/c3ystmXNY6dTB6kcR50BsLnWWTVkSKQ1JZHumJb6pA3QgAKl+AaKKHTM/71/9NNWbX/H/d0umHvdCQvWK4FhTvLDg3rztxShMaIMuI2HObMF5rN8KKPf8wQ1+8njIz56pE= 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: 881fa8247e8811f1aa26b74ffac11d73-20260713 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:d033092c-4aa8-4159-acc8-ea1f5dd7a3c0,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:18b88f4baafce44e06f5bd80fdd65fdd,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: 881fa8247e8811f1aa26b74ffac11d73-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 1196695508; Mon, 13 Jul 2026 15:00:28 +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 Subject: [PATCH v1] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add Date: Mon, 13 Jul 2026 15:00:24 +0800 Message-Id: <20260713070024.153552-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: Harry Yoo Signed-off-by: Hongling Zeng Acked-by: Harry Yoo (Oracle) --- Change in v1: -Correct the email --- 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