[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y39OAFcm6svORad4@hyeyoo>
Date: Thu, 24 Nov 2022 19:57:04 +0900
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: Feng Tang <feng.tang@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Andrey Konovalov <andreyknvl@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
linux-mm@...ck.org, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 -next 1/2] mm/slb: add is_kmalloc_cache() helper
function
On Wed, Nov 23, 2022 at 08:31:58PM +0800, Feng Tang wrote:
> commit 6edf2576a6cc ("mm/slub: enable debugging memory wasting of
> kmalloc") introduces 'SLAB_KMALLOC' bit specifying whether a
> kmem_cache is a kmalloc cache for slab/slub (slob doesn't have
> dedicated kmalloc caches).
>
> Add a helper inline function for other components like kasan to
> simplify code.
>
> Signed-off-by: Feng Tang <feng.tang@...el.com>
> ---
> changlog:
>
> since v1:
> * don't use macro for the helper (Andrew Morton)
> * place the inline function in mm/slb.h to solve data structure
> definition issue (Vlastimil Babka)
>
> mm/slab.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/mm/slab.h b/mm/slab.h
> index e3b3231af742..0d72fd62751a 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -325,6 +325,14 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size,
> }
> #endif
>
> +static inline bool is_kmalloc_cache(struct kmem_cache *s)
> +{
> +#ifndef CONFIG_SLOB
> + return (s->flags & SLAB_KMALLOC);
> +#else
> + return false;
> +#endif
> +}
>
> /* Legal flag mask for kmem_cache_create(), for various configurations */
> #define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | \
> --
> 2.34.1
With Vlastimil's comment:
Acked-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
--
Thanks,
Hyeonggon
Powered by blists - more mailing lists