[PATCH v2 00/23] common kmalloc for SLUB and SLAB v2

From: Hyeonggon Yoo
Date: Thu Apr 14 2022 - 04:57:52 EST


Changes since v1:
- The code is basically same, but split some patches to make it
easier to review.
- Adjusted comments and added Reviewed-by from Vlastimil. Thanks!

Hello, this series is cleanup of kmalloc code. After this series,
kmalloc subsystem is perfectly generalized on SLAB and SLUB.

This series is not small, but each patch is easy to review and
I bet you will like this :)

Many thanks to Matthew, Marco, Vlastimil who gave comments
in previous series.

Any feedbacks will be appreciated.
Thanks!

======== series description =======

patch 1-2 make slab_alloc_node() in SLAB available for non-NUMA
configurations for further cleanup.

patch 3-12 remove duplicate code in common kmalloc functions.

patch 13 makes SLAB pass requests larger than order-1 page to page
allocator. This is useful for further generalization.

patch 14-16 unify tracepoints. after them, we use only
kmem_cache_alloc and kmem_cache_free tracepoints in slab allocators.

patch 17-18 generalize whole kmalloc subsystem on SLAB/SLUB.

patch 19-20 factor out common code of __kmalloc_node()
and __kmalloc_node_track_caller().

patch 21 removes now unnecessary kmem_cache_alloc_node_trace().

patch 22-23 is small improvements of __ksize(). They are not part of
generalization but depends on this series.

Hyeonggon Yoo (23):
mm/slab: move NUMA-related code to __do_cache_alloc()
mm/slab: cleanup slab_alloc() and slab_alloc_node()
mm/slab_common: remove CONFIG_NUMA ifdefs for common kmalloc functions
mm/slab_common: cleanup kmalloc_track_caller()
mm/slab_common: cleanup __kmalloc()
mm/sl[auo]b: fold kmalloc_order_trace() into kmalloc_large()
mm/slub: move kmalloc_large_node() to slab_common.c
mm/slab_common: make kmalloc_large_node() consistent with
kmalloc_large()
mm/slab_common: cleanup kmalloc_large()
mm/slab_common: cleanup kmem_cache_alloc{,node,lru}
mm/slab_common: kmalloc_node: pass large requests to page allocator
mm/slab_common: cleanup kmalloc()
mm/slab: kmalloc: pass requests larger than order-1 page to page
allocator
mm/slab_common: print cache name in tracepoints
mm/slab_common: use same tracepoint in kmalloc and normal caches
mm/slab_common: rename tracepoint
mm/slab_common: implement __kmem_cache_free()
mm/sl[au]b: generalize kmalloc subsystem
mm/slab_common: add kasan_kmalloc() in __kmalloc_node_track_caller()
mm/slab_common: factor out __do_kmalloc_node()
mm/sl[au]b: remove kmem_cache_alloc_node_trace()
mm/sl[auo]b: move definition of __ksize() to mm/slab.h
mm/sl[au]b: check if large object is valid in __ksize()

include/linux/slab.h | 245 ++++++++++++-------------
include/trace/events/kmem.h | 109 ++---------
mm/slab.c | 354 ++++++------------------------------
mm/slab.h | 9 +
mm/slab_common.c | 146 ++++++++++++---
mm/slob.c | 78 +++-----
mm/slub.c | 264 ++-------------------------
7 files changed, 350 insertions(+), 855 deletions(-)

--
2.32.0