Re: [PATCH -next 1/2] mm/slab: add is_kmalloc_cache() helper macro

From: Andrew Morton
Date: Mon Nov 21 2022 - 15:19:55 EST


On Mon, 21 Nov 2022 21:50:23 +0800 Feng Tang <feng.tang@xxxxxxxxx> wrote:

> +#ifndef CONFIG_SLOB
> +#define is_kmalloc_cache(s) ((s)->flags & SLAB_KMALLOC)
> +#else
> +#define is_kmalloc_cache(s) (false)
> +#endif

Could be implemented as a static inline C function, yes?

If so, that's always best. For (silly) example, consider the behaviour
of

x = is_kmalloc_cache(s++);

with and without CONFIG_SLOB.