SLAB_ACCOUNT(9)
π SLAB_ACCOUNT(9) π
okay so real talk, this is a page from the Kernel API Manual (the (9) is giving kernel-internals, very main character of it) and it's about one tiny flag that does a whole lot of heavy lifting. buckle up bestie π
β¨ NAME β¨
SLAB_ACCOUNT β the flag that makes your slab cache account its allocations to memcg. like, permanently, for everyone. π«Ά
πΈ SYNOPSIS πΈ
SLAB_ACCOUNT
that's it. that's the whole synopsis. no arguments, no options, just vibes and one flag name. periodt. π
π¦ DESCRIPTION π¦
okay so here's the tea β: when you set this flag on a cache, all object allocations from that cache get memcg accounted β every single one.
and the way that this is different from normal is: it doesn't matter whether __GFP_ACCOUNT is passed or not passed to the individual allocations. it's accounted either way. the cache said what it said. π₯
like, normally the per-allocation flag is the one calling the shots, but SLAB_ACCOUNT is the overachiever that just handles it at the cache level so you literally cannot forget. iconic behavior, ngl. π
tiny reminder bestie: this is a cache-wide setting, so it applies to all allocations from this cache, no exceptions, no "but I didn't pass __GFP_ACCOUNT". that's the whole point. π«‘
π SEE ALSO π
grab a snack, this list is long, but every single one is here because the kernel devs said so and we respect them for it π
Kernel file ./include/linux/slab.hSLAB_HWCACHE_ALIGN(9)SLAB_TYPESAFE_BY_RCU(9)SLAB_RECLAIM_ACCOUNT(9)struct kmem_cache_args(9)kmem_cache_create_usercopy(9)kmem_cache_create(9)krealloc_node_align(9)kmem_cache_alloc(9)kmem_cache_charge(9)kmalloc(9)kmalloc_nolock(9)__alloc_objs(9)__alloc_flex(9)kmalloc_obj(9)kmalloc_objs(9)kmalloc_flex(9)kmalloc_array(9)krealloc_array(9)kcalloc(9)kzalloc(9)kvmalloc_node(9)kvrealloc_node_align(9)kmalloc_size_roundup(9)
okay that's the whole page, go be amazing with your accounting flag π
source/version: this lil guy lives in ./include/linux and the page is dated October 2026 β so yeah, freshest of the fresh, no cap. πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms