Re: [PATCH v2 05/23] mm/slab_common: cleanup __kmalloc()

From: Vlastimil Babka
Date: Tue Apr 26 2022 - 12:02:26 EST


On 4/14/22 10:57, Hyeonggon Yoo wrote:
> Make __kmalloc() wrapper of __kmalloc_node().

Again/similarly, looks like this will make SLUB not miss trace for
kmalloc_large() anymore.

> Signed-off-by: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx>

Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>

Nit below:

> ---
> include/linux/slab.h | 13 ++++++++++---
> mm/slab.c | 34 ----------------------------------
> mm/slob.c | 6 ------
> mm/slub.c | 23 -----------------------
> 4 files changed, 10 insertions(+), 66 deletions(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index acdb4b7428f9..4c06d15f731c 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -419,7 +419,16 @@ static __always_inline unsigned int __kmalloc_index(size_t size,
> #define kmalloc_index(s) __kmalloc_index(s, true)
> #endif /* !CONFIG_SLOB */
>
> -void *__kmalloc(size_t size, gfp_t flags) __assume_kmalloc_alignment __alloc_size(1);
> +extern void *__kmalloc_node(size_t size, gfp_t flags, int node)
> + __assume_kmalloc_alignment
> + __alloc_size(1);
> +

Again, no 'extern' please.

> +static __always_inline __alloc_size(1) __assume_kmalloc_alignment
> +void *__kmalloc(size_t size, gfp_t flags)
> +{
> + return __kmalloc_node(size, flags, NUMA_NO_NODE);
> +}
> +
> void *kmem_cache_alloc(struct kmem_cache *s, gfp_t flags) __assume_slab_alignment __malloc;
> void *kmem_cache_alloc_lru(struct kmem_cache *s, struct list_lru *lru,
> gfp_t gfpflags) __assume_slab_alignment __malloc;