linux/mm/kfence
Vlastimil Babka (SUSE) a6172cca15 mm/slab, kfence, memcg: completely remove obj_ext for kfence objects
We have already disabled memory allocation profiling for objects
allocated for KFENCE to avoid complexity. KFENCE allocations are rare
and there can be only CONFIG_KFENCE_NUM_OBJECTS (default to 255)
outstanding ones at any time, so they are among noise in the profiling
stats.

For the same reasons, we can stop memcg_kmem accounting of kfence
objects as their memory usage will be negligible wrt any practical
memcg limits.

This allows us simplifying the code and getting rid of
is_kfence_address() checks in various places, including slab_obj_ext()'s
usage of obj_to_index(). Instead we rely on the fact that slab_obj_exts()
will now always return 0 for a kfence object's fake slab, which makes
those places unreachable.

All we need to do to keep this assumption valid is not to allocate
obj_exts for kfence objects, so the checks need to guard
alloc_slab_obj_exts() where necessary.

Suggested-by: Harry Yoo <harry@kernel.org>
Link: https://patch.msgid.link/20260727-b4-objext_split-v3-13-c29ef0f1f257@kernel.org
Reviewed-by: Hao Li <hao.li@linux.dev>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
2026-08-04 12:30:45 +02:00
..
.kunitconfig kfence: test: use new suite_{init/exit} support, add .kunitconfig 2022-05-02 12:35:57 -06:00
core.c mm/slab, kfence, memcg: completely remove obj_ext for kfence objects 2026-08-04 12:30:45 +02:00
kfence_test.c mm/slab: remove objs_per_slab() 2026-07-31 15:50:47 +02:00
kfence.h mm/slab, kfence, memcg: completely remove obj_ext for kfence objects 2026-08-04 12:30:45 +02:00
Makefile kfence: Enable context analysis 2026-01-05 16:43:34 +01:00
report.c kfence: add kfence.fault parameter 2026-04-05 13:53:06 -07:00