# Re: \[PATCH v5 2/3\] mm: memcg/slab: Create a new set of kmalloc-cg-\<n\> caches

- From: Andrew Morton \<hidden\>
- Date: 2021-05-13 00:36:26 
- List: cgroups
- Page: https://ratatoskr.run/cgroups/2021/05/1376230
- Thread: https://ratatoskr.run/cgroups/2021/05/6359219/t.md

```text
On Wed, 12 May 2021 10:54:19 -0400 Waiman Long [ref] wrote:

> >   include/linux/slab.h | 42 +++++++++++++++++++++++++++++++++---------
> >   mm/slab_common.c     | 25 +++++++++++++++++--------
> >   2 files changed, 50 insertions(+), 17 deletions(-)
> 
> The following are the diff's from previous version. It turns out that 
> the previous patch doesn't work if CONFIG_ZONE_DMA isn't defined.
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index a51cad5f561c..aa7f6c222a60 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -312,16 +312,17 @@ static inline void __check_heap_object(const void 
> *ptr, un
> signed long n,
>    */
>   enum kmalloc_cache_type {
>       KMALLOC_NORMAL = 0,
> -#ifdef CONFIG_MEMCG_KMEM
> -    KMALLOC_CGROUP,
> -#else
> +#ifndef CONFIG_ZONE_DMA
> +    KMALLOC_DMA = KMALLOC_NORMAL,
> +#endif
> +#ifndef CONFIG_MEMCG_KMEM
>       KMALLOC_CGROUP = KMALLOC_NORMAL,
> +#else
> +    KMALLOC_CGROUP,
>   #endif
>       KMALLOC_RECLAIM,
>   #ifdef CONFIG_ZONE_DMA
>       KMALLOC_DMA,
> -#else
> -    KMALLOC_DMA = KMALLOC_NORMAL,
>   #endif
>       NR_KMALLOC_TYPES
>   };

I assume this fixes
https://lkml.kernel.org/r/20210512152806.2492ca42-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org?

```
