🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26426

Re: [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches

#26426
From: Harry Yoo
Date: Thu, 03 Dec 2026 14:27
40 lines
11060 bytes
On Thu, Dec 03, 2026 at 02:17:21PM +0000, Hao Li wrote:
> On Wed, Nov 25, 2026 at 09:37:15PM +0000, Harry Yoo (Meta) wrote:
> > Now that all caches whose objects may be allocated with __GFP_ACCOUNT
> > specify SLAB_MAY_ACCOUNT (or SLAB_ACCOUNT, which implies it), stop
> > assuming any cache may be used with __GFP_ACCOUNT. This avoids wasting
> > the objcg slot in slabobj_ext for caches that are never charged to a
> > memcg.
> > 
> > Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
> > ---
> > diff --git a/mm/slab_common.c b/mm/slab_common.c
> > index 193b5a03bc47..464695504248 100644
> > --- a/mm/slab_common.c
> > +++ b/mm/slab_common.c
> > @@ -367,12 +367,10 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
> >  		goto out_unlock;
> >  	}
> >  
> > -	/*
> > -	 * For now we assume any cache can be used with __GFP_ACCOUNT and thus
> > -	 * may need to store objcg pointers for objects
> > -	 */
> > -	if (!mem_cgroup_kmem_disabled())
> > +	if (flags & SLAB_ACCOUNT)
> >  		flags |= SLAB_MAY_ACCOUNT;
> > +	if (mem_cgroup_kmem_disabled())
> > +		flags &= ~SLAB_MAY_ACCOUNT;
> 
> Btw, say maple_node/sk_buff/... could be merged with cacheX before. After this
> patch, cacheX loses SLAB_MAY_ACCOUNT while we still set SLAB_MAY_ACCOUNT for
> maple_node explicitly, so they can't be merged anymore. Not sure if it matters,
> though.

Hmm you mean SLAB_ACCOUNT and SLAB_MAY_ACCOUNT should be cleared at
run-time during merging decision with cgroup.memory=nokmem? 

-- 
Cheers,
Harry / Hyeonggon
Technical Details
Message-ID: <axF7O_lIG4zf9L-9@thinkstation>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376663-linux-kernel-netdev=dewy.ru
References: <20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-0-7c680f02a734@kernel.org> <20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-14-7c680f02a734@kernel.org> <axF1jxUBKq0Y00tw@fedora>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376663-linux-kernel-netdev=dewy.ru
From: harry@kernel.org (Harry Yoo)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH slab/for-next v2 14/14] mm/slab: do not set
 SLAB_MAY_ACCOUNT for all caches
Date: Thu, 3 Dec 2026 14:27:25 +0000
Organization: Usenet Network
Message-ID: <axF7O_lIG4zf9L-9@thinkstation>
References: <20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-0-7c680f02a734@kernel.org>
 <20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-14-7c680f02a734@kernel.org>
 <axF1jxUBKq0Y00tw@fedora>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2513594"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:lo1jMfFjApYHbTWvSM0BiU/e084= sha256:e3WqsfAkFizYcvQ4hbZk/ftAOzyud6j2t2WgW8eTcWs=
	sha1:K0PL/oyiDgKH9G1gUPwegnpfusE= sha256:dtDqpdUtFmNb3TfC2fjTKfd5/Qw+bOzLEHiqmnyMJyg=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 5163B117980; Thu,  3 Dec 2026 17:27:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id V4ZUNB4iA3Dp;
	Thu,  3 Dec 2026 17:27:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376663-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 66CAA11790E; Thu,  3 Dec 2026 17:27:41 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 541932C468; Thu,  3 Dec 2026 14:27:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796308058;
	b=ocZBpDSutsP/7vDUiTAocErxsnyzn1hxE8GPyMrxtjvF9FRqGZTWZR/1jkcpp6Nyktfk
	 esJBz/VMuyvc08xF5zibvBsOz4OJ5gm3ufhb0E+xcoH8WJyqAm6Hr2rHMyHZrINf6/2d6
	 p6NRILrZJL+RiGRlrLcIaeJ76aDt0BN5D3UDtV6HNl/4SnIJWcNskVp2CT9+qMD4/mawL
	 MlT/BwZdZ9WX/gKnKdlKQ6o4Mt7ZzZxl8NE6aTFpqbDyltYTEgZ5oFrf2TGxvBFcvDo3O
	 ABoPKFBNA3fICj6/8iP+D/qPfq2q1kdGI73R0hFmxWns/QWgbmNYoIIp3+qgv5ak7lg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796308058;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=q5+pstrq33v/90Pm42Tsvow7HsVOQOP8WDBMlqDtk80=;
	b=iTlsWW24NXywl5HVw70Ap5FwhX+mriUvFjBAPNjP/n/mvCqsZ/PapGLbo5DFrFsvY6n0
	 wZuLWPGzvMwhugWZAUtZI4jy/j5FcRLOj/WVNnGSnzOC0b64WLcQrBVSTjme77/ZJjEjl
	 rWqoQFUS8rQ+0HVlDhvRjRHHvJZykMJgYI1Mrg0KfNiR2Cgv+/hs82BpBLrNQtsDxPkko
	 DMtSk3WmbxFbZesIXOuaq6vDSDoHBwcaRLDnOEgbBJKMhzcKlCl/+cgbxNIUXfKMhqjSr
	 PalUTacl2JhsM8bsaELq5YxFszZ2cfP0I/nub7dBpHPrS+Xji7KdAgQS4KQta1zP8AA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=n0CIsyru;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E571606A330;
	Thu,  3 Dec 2026 14:27:38 +0000 (UTC)
X-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=n0CIsyru
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796308047;
	b=V1UXm2DAUHReFKLv6/ErSImAqdTgsDw3k8Ez4wWWuvG5ubjhT4ytkY0uUEzSlJKtmL08
	 adInu8rjRDfZInGlDh1yGX3OSv2TuGz8IZV72Otln5f1rGfbzMzEdsIRg2BVPuY+cUL8P
	 4QJNn6lK0gMpf7ljpA7GwQenAAcTfo0CFYlKXmCqmfcwfhMk2IgXynbsrYpvj2J051csa
	 9VJI+hBcu0JZOHNu4aCGwuxOYxMAToIx1iegNmdmJGIF98ZhjNyR0IK1awb9CXvDbn3Ia
	 kAz8vF5CsqNbYAXZZTfDbDnrt+FPS+5rzDLH1WtxpVhY+95uDcpBCt5MsjFGuulqAbA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796308047;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=q5+pstrq33v/90Pm42Tsvow7HsVOQOP8WDBMlqDtk80=;
	b=2N2BDYjaAfY/XkTifHgdMssCb/avYmU8ROM+NTvlyetfS9ILGyiaJqQ/p8nZ2xFTzHVl
	 +F6gyK0d6Bs0a4GGEXIMEhx9F7npiydZRj/PI+IiJGq5xqtIOKrIe+BL/tgNuFVOCaJCq
	 Wl8KxmoZYdIvfqX9frOJU4ypdixpyqNjs+kM3dI2Y27P7J7RmLuJ+sDWh60x+DIU9NzaK
	 sSsK0GliULCc58RfFgvDvl9++l5eqYBskmM/MQhiDkcMpkrPFC7N9hluhMN+gALiIE9aV
	 WpgCBy+pABe9LVyTr4vnd6KARiwHzT9i3D0MurGJgtlfWqArinSWZdYz5I5/5m6H/yA==
X-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=n0CIsyru;
	arc=none smtp.remote-ip=100.103.45.18
X-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 7762F606A322;
	Thu,  3 Dec 2026 14:27:27 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C9031F0089A;
	Thu,  3 Dec 2026 14:27:26 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796308047;
	bh=q5+pstrq33v/90Pm42Tsvow7HsVOQOP8WDBMlqDtk80=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=n0CIsyruqAvdvHt9BOvyZnQQ1mtfLKGojyla258ZJiSBquYg8qYjZ9Mw4CdwvBULF
	 Ag1tng+p5XBUniR472WOHRQM0aMZXIWIxshhk4JYoCsyvOtMJxnCqcx097au5fR7He
	 LhVKiY4UmSk3+HPAKeDDmDblh1d+vPOQqRKxCI8/6kVu9A76BXsBn6sFEqvab9zA8A
	 ORO6u2mYi6LtBkPZ7FP60KZDt2Xoae+/I82azfFAF/CstBCBwim2EB86aRIdRA64cs
	 ra05aWUwPnxBNosipHe6xzvo3kRUrUVS3c9FYj9OI0CZZ8y3jChA/sVc0E+AhZT4I6
	 3XrLpdIAfGEYA==
X-Cc: Vlastimil Babka <vbabka@kernel.org>, 
	Andrew Morton <akpm@linux-foundation.org>, Suren Baghdasaryan <surenb@google.com>, 
	Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, 
	Shakeel Butt <shakeel.butt@linux.dev>, Roman Gushchin <roman.gushchin@linux.dev>, 
	Christoph Lameter <cl@gentwo.org>, David Rientjes <rientjes@google.com>, 
	Muchun Song <muchun.song@linux.dev>, Hao Ge <hao.ge@linux.dev>, Pedro Falcato <pfalcato@suse.de>, 
	linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, 
	"Liam R. Howlett" <liam@infradead.org>, Alice Ryhl <aliceryhl@google.com>, 
	Andrew Ballance <andrewjballance@gmail.com>, Matthew Wilcox <willy@infradead.org>, 
	linux-fsdevel@vger.kernel.org, Alexander Viro <viro@zeniv.linux.org.uk>, 
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>, "David S. Miller" <davem@davemloft.net>, 
	Jakub Kicinski <kuba@kernel.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, 
	Jiayuan Chen <jiayuan.chen@linux.dev>, netdev@vger.kernel.org, Kees Cook <kees@kernel.org>, 
	David Hildenbrand <david@kernel.org>, Lorenzo Stoakes <ljs@kernel.org>, 
	Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, 
	Mark Rutland <mark.rutland@arm.com>, Madhavan Srinivasan <maddy@linux.ibm.com>, 
	Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, 
	Robin Murphy <robin.murphy@arm.com>, "Joerg Roedel (AMD)" <joro@8bytes.org>, 
	Amir Goldstein <amir73il@gmail.com>, Casey Schaufler <casey@schaufler-ca.com>, 
	Paul Moore <paul@paul-moore.com>, James Morris <jmorris@namei.org>, 
	"Serge E. Hallyn" <serge@hallyn.com>, linux-security-module@vger.kernel.org, 
	Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, 
	Johannes Berg <johannes@sipsolutions.net>, Eric Dumazet <edumazet@kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <axF1jxUBKq0Y00tw@fedora>