Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796051680; b=WawUe/IrCaZ38QdVNWuGrwz3LLusuDa67IrOxBXUyghhq+jyqq5lrF9/RyfBfwIZKBYk Ari8a10eTbeewTnW0iVkC5eSnghmHoAB9xXdv/BRnlqjzXflM7KPtGt+wg6IM+ZSmBEv1 IHkGnLqMUgYK/WOcND5m6Td2dSNuu9tYNfESukLVGI5y0t3zUt/sIKCCLu1jwqFCh2unR Yr3tlkQQWxIkP+9KbOs5VnZOgMT+UP8NSXInvoJnJHsdJSs/74Vz/FD7g6opF4kgTZVAl Gq/yJjFwlkJFlmGJSx0H4yVHBNQ+Ua8dDJLbDVLPXfJYeq0J/2QIzRa0SSQlWG7t/rQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796051680; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=kz+8dGmAHx0N8xMIzrGUkuqEnVBhsJyGM6Fp5sCABaM=; b=UPwrqbmA/eTZ9abqQVw//Sw95pUTNB1Hj1guz9FfpJ6NZokozXDvYym0Cqw2oFbicoHA FgZ9ibD+QeVN4ePHTAP1kCMHhzoIUpap6xESBfvtUm9PEp0W5zh6f1wwfz3qGwI0wbJpH 8cqM6Uil+tBdqyO/HrWYzmdeH4k0lAqjpwTajWLqI50fHfage1oVYlmTQsKZrNhz/Hcn1 6u/iE4MmjA96v4wT1DDA1Q/2O4yZnuewe51cSt7KmZ4UkHsgynHT0AVLdLsYbdmEBEG5Q 0MmyVW/FctLOu0b7zlN55OVQONSOLuUwzEEe0B0mdMKBjT+8hGF+6NIMlwE7iJ5KzPg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oSTK6lIh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FE7A606A325; Mon, 30 Nov 2026 15:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oSTK6lIh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5069A1F0089A; Mon, 30 Nov 2026 15:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796051679; bh=kz+8dGmAHx0N8xMIzrGUkuqEnVBhsJyGM6Fp5sCABaM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=oSTK6lIhD6gdWu8EajLB++GRWQzoyxdApCHtSxyyL7hg7nC4GFK2yh0d9sgd1QHGu emXkCDYTUVvQs+ppgdfpRMUSOHC0CCFRs7F8mVRsSuSWBF00ILuQEK7DSs51eitToS puHaOkcOcqinOJwVrW2DK7AnfTcuyghADXZg8RubupA4xfPdteUCATLuG/5NkLjUPH lBDhpaObv+kzWJGdm06MatkQMB61XIE2apS6/wh58IncxtH3NU4sEDJu83giWvTj5F Sxkojg3H+Y5sgUpdX3Y5yYpEj4RM9RHeuylpln09qM+6RmsV34o/46vjAcO7iwjKAA W9LJeuiq/XtYQ== Date: Mon, 30 Nov 2026 15:14:37 +0000 From: Harry Yoo To: "Vlastimil Babka (SUSE)" Cc: Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , "David Hildenbrand (Arm)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chris Mason , stable@vger.kernel.org Subject: Re: [PATCH 3/4] mm/slab: keep caches that drop debug flags unmergeable Message-ID: References: <20261127-slab-ai-fixes-v1-0-cf13b6be6692@kernel.org> <20261127-slab-ai-fixes-v1-3-cf13b6be6692@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261127-slab-ai-fixes-v1-3-cf13b6be6692@kernel.org> On Fri, Nov 27, 2026 at 09:12:32PM +0100, Vlastimil Babka (SUSE) wrote: > From: Chris Mason > > When slab_debug boot parameter contains the O flag and a list of caches, > two caches can get the same id in /sys/kernel/slab, so sysfs warns about > a duplicate filename and one of them is missing there as a result. > > create_unique_id() builds the id of a mergeable cache from its size and > flags, so caches that are mergeable and result in the same unique id > must get merged - otherwise a duplicate id would try to be created. > > But find_mergeable() doesn't merge a new cache that has (at that point) > debug flags, and with O do_kmem_cache_create() later drops the flags > that store metadata if they raise the minimum slab order, and the cache > can become mergeable again, but too late. An example with the id: > > slab_debug=OU,sgpool-128 > > biovec-max mergeable :0004096 > sgpool-128 has U, so not merged into biovec-max > later U dropped, so mergeable :0004096 > > sysfs_slab_add() has a check for such caches since commit 11066386efa6 > ("slub: fix sysfs duplicate filename creation when slub_debug=O") but it > tests only the global slub_debug, and flags given for a list of caches > don't end up there. > > The fix used here is to mark the cache unmergeable when its debug flags > are dropped. With that, we can also effectively revert commit > 11066386efa6 since the global slub_debug is covered by this fix too. > > Ideally we would evaluate mergeability with the O flag precisely > (dropping the U soon enough to merge) but that would be a more involved > change and probably not worth the effort. > > [vbabka: revert 11066386efa6, tweak commit message] > > Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks") > Cc: > Signed-off-by: Chris Mason > Signed-off-by: David Hildenbrand (Arm) > Co-developed-by: Vlastimil Babka (SUSE) > Signed-off-by: Vlastimil Babka (SUSE) > --- Looks good to me, Reviewed-by: Harry Yoo (Meta) -- Cheers, Harry / Hyeonggon