mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using
authorHyeonggon Yoo <42.hyeyoo@gmail.com>
Wed, 17 Aug 2022 10:18:24 +0000 (19:18 +0900)
committerVlastimil Babka <vbabka@suse.cz>
Thu, 1 Sep 2022 09:44:26 +0000 (11:44 +0200)
commit2c1d697fb8ba6d2d44f914d4268ae1ccdf025f1b
treea2e3b945b6a96e59c319083739023ba52e932fcb
parent11e9734bcb6a7361943f993eba4e97f5812120d8
mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using

Drop kmem_alloc event class, and define kmalloc and kmem_cache_alloc
using TRACE_EVENT() macro.

And then this patch does:
   - Do not pass pointer to struct kmem_cache to trace_kmalloc.
     gfp flag is enough to know if it's accounted or not.
   - Avoid dereferencing s->object_size and s->size when not using kmem_cache_alloc event.
   - Avoid dereferencing s->name in when not using kmem_cache_free event.
   - Adjust s->size to SLOB_UNITS(s->size) * SLOB_UNIT in SLOB

Cc: Vasily Averin <vasily.averin@linux.dev>
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/trace/events/kmem.h
mm/slab.c
mm/slab_common.c
mm/slob.c
mm/slub.c