On 4/14/22 10:57, Hyeonggon Yoo wrote: > Now everything in kmalloc subsystem can be generalized. > Let's do it! > > Generalize __kmalloc_node_track_caller(), kfree(), __ksize(), > __kmalloc_node() and move them to slab_common.c. > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> > --- > mm/slab.c | 94 ----------------------------------------------- > mm/slab_common.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++ > mm/slub.c | 88 -------------------------------------------- > 3 files changed, 95 insertions(+), 182 deletions(-) > > diff --git a/mm/slab.c b/mm/slab.c > index d35873da5572..fc00aca62ae3 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3527,36 +3527,6 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep, > EXPORT_SYMBOL(kmem_cache_alloc_node_trace); > #endif > > -static __always_inline void * > -__do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller) > -{ > - struct kmem_cache *cachep; > - void *ret; > - > - if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) > - return kmalloc_large_node(size, flags, node); > - cachep = kmalloc_slab(size, flags); > - if (unlikely(ZERO_OR_NULL_PTR(cachep))) > - return cachep; > - ret = kmem_cache_alloc_node_trace(cachep, flags, node, size); > - ret = kasan_kmalloc(cachep, ret, size, flags); SLAB did kasan_kmalloc() when called from __kmalloc_node_track_caller(), and will not do after this patch, until the next patch 19/23. So I would just fold it to this patch. > - > - return ret; > -} > - > -void *__kmalloc_node(size_t size, gfp_t flags, int node) > -{ > - return __do_kmalloc_node(size, flags, node, _RET_IP_); > -} > -EXPORT_SYMBOL(__kmalloc_node); > - > -void *__kmalloc_node_track_caller(size_t size, gfp_t flags, > - int node, unsigned long caller) > -{ > - return __do_kmalloc_node(size, flags, node, caller); > -} > -EXPORT_SYMBOL(__kmalloc_node_track_caller); > - > #ifdef CONFIG_PRINTK > void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) > {