Re: [PATCH v2 12/13] mm/slab: add cache_ and slab_needs_objcg() helpers
Hao Li <[email protected]> Mon, 27 Jul 2026 14:17:59 +0800
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <amb0jBAYvObMYBVv@fedora> |
On Fri, Jul 24, 2026 at 06:31:51PM +0200, Vlastimil Babka (SUSE) wrote: > On 7/24/26 11:41, Hao Li wrote: > > On Mon, Jul 20, 2026 at 04:16:26PM +0200, Vlastimil Babka (SUSE) wrote: > >> Slabs of some caches never need the objcg part of struct slabobj_ext. > >> Introduce helpers to query this for a cache or a slab. > >> > >> Introduce SLAB_MAY_ACCOUNT flag that is currently only internal and only > >> is_kmalloc_normal() caches don't have the flag. > > > > it seems this could be "only type == KMALLOC_NORMAL caches don't have this > > flag". > > I think not, because with SLUB_TINY, Ah, right, I missed the SLUB_TINY case. > a KMALLOC_NORMAL cache can have > SLAB_RECLAIM_ACCOUNT flag and thus is not is_kmalloc_normal() Just a minor detail though: under SLUB_TINY, SLAB_RECLAIM_ACCOUNT isn't used, and new_kmalloc_cache() checks KMALLOC_RECLAIM != KMALLOC_NORMAL before setting it. So is_kmalloc_normal() should still evaluate to true. > and may need objcgs? Agree. Under SLUB_TINY, we indeed need to set SLAB_MAY_ACCOUNT. > > Yep it's subtle :/ > Yeah, it's pretty subtle. Since the full case matrix is tricky to summarize accurately in one sentence, I think it might be cleaner to simply drop "only is_kmalloc_normal() caches don't have the flag". -- Thanks, Hao