diff options
| author | Vlastimil Babka (SUSE) <vbabka@kernel.org> | 2026-07-27 14:54:05 +0200 |
|---|---|---|
| committer | Vlastimil Babka (SUSE) <vbabka@kernel.org> | 2026-08-04 12:23:22 +0200 |
| commit | 7def2e8549e5186cd4de97ab5ce56f7944d3da59 (patch) | |
| tree | 4f0f72704e7af2856102aa8032683b077cf523ba /scripts | |
| parent | c4ec6cb55750c80fc3d43b310eb7ccab33df3dcd (diff) | |
| download | linux-next-7def2e8549e5186cd4de97ab5ce56f7944d3da59.tar.gz linux-next-7def2e8549e5186cd4de97ab5ce56f7944d3da59.zip | |
mm/slab: add cache_ and slab_needs_objcg() helpers
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 all
caches have it set except:
- KMALLOC_NORMAL caches, as long as KMALLOC_RECLAIM caches are separate
- KMALLOC_NO_OBJ_EXT caches, if they exist
For named caches we currently can't derive SLAB_MAY_ACCOUNT from
SLAB_ACCOUNT because some caches might be created without SLAB_ACCOUNT
and then used both with and without __GFP_ACCOUNT concurrently,
allocating obj_ext arrays on demand. So just add the SLAB_MAY_ACCOUNT
to all kmem caches, unless kmem accounting is disabled.
This can be improved later by finding out all caches used with
__GFP_ACCOUNT, creating them with the SLAB_MAY_ACCOUNT flag explicitly,
and then ignoring __GFP_ACCOUNT for all other caches (possibly with a
warning).
To make the evaluation of slab_needs_objcg() faster in the allocation
and free fast paths, add a obj_exts_needs_objcg flag into slab itself.
This optimization is only available on 64bit architectures where free
bits are available for the flag.
Reviewed-by: Hao Li <hao.li@linux.dev>
Link: https://patch.msgid.link/20260727-b4-objext_split-v3-11-c29ef0f1f257@kernel.org
Reviewed-by: Harry Yoo <harry@kernel.org>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
