On Sat, May 02, 2020 at 11:54:09PM +0000, Christoph Lameter wrote: > On Thu, 30 Apr 2020, Roman Gushchin wrote: > > > Sorry, but what exactly do you mean? > > I think the right approach is to add a pointer to each slab object for > memcg support. > As I understand, embedding the memcg pointer will hopefully make allocations cheaper in terms of CPU, but will require more memory. And you think that it's worth it. Is it a correct understanding? Can you, please, describe a bit more detailed how it should be done from your point of view? I mean where to store the pointer, should it be SLAB/SLUB-specific code or a generic code, what do to with kmallocs alignments, should we merge slabs which had a different size before and now have the same because of the memcg pointer and aligment, etc. I'm happy to follow your advice and perform some tests to get an idea of how significant the memory overhead is and how big are CPU savings. I guess with these numbers it will be easy to make a decision. Thanks!