Re: [PATCH v2] memcg: Prevent memcg caches to be both OFF_SLAB & OBJFREELIST_SLAB

From: Christoph Lameter
Date: Thu Nov 03 2016 - 16:34:09 EST


On Wed, 2 Nov 2016, David Rientjes wrote:

> > Christoph on the first version advised removing invalid flags on the
> > caller and checking they are correct in kmem_cache_create. The memcg
> > path putting the wrong flags is through create_cache but I still used
> > this approach.
> >
>
> I think this is a rather trivial point since it doesn't matter if we clear
> invalid flags on the caller or in the callee and obviously
> kmem_cache_create() does it in the callee.

In order to be correct we need to do the following:

kmem_cache_create should check for invalid flags (and that includes
internal alloocator flgs) being set and refuse to create the slab cache.

memcg needs to call kmem_cache_create without any internal flags.

I also want to make sure that there are no other callers that specify
extraneou flags while we are at it.