Re: [PATCH V2 2/2] slub: add missing kmem cgroup support to kmem_cache_free_bulk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 7 Nov 2015 23:25:48 +0300 Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> wrote:
> On Sat, Nov 07, 2015 at 05:53:38PM +0100, Jesper Dangaard Brouer wrote:
> > On Thu, 5 Nov 2015 19:25:14 +0300 Vladimir Davydov <vdavydov@xxxxxxxxxxxxx> wrote:
> > 
> > > On Thu, Nov 05, 2015 at 04:38:06PM +0100, Jesper Dangaard Brouer wrote:
> > > > Initial implementation missed support for kmem cgroup support
> > > > in kmem_cache_free_bulk() call, add this.
> > > > 
> > > > If CONFIG_MEMCG_KMEM is not enabled, the compiler should
> > > > be smart enough to not add any asm code.
> > > > 
> > > > Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
> > > > 
> > > > ---
> > > > V2: Fixes according to input from:
> > > >  Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>
> > > >  and Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
> > > > 
[...]
> > > > diff --git a/mm/slub.c b/mm/slub.c
> > > > index 8e9e9b2ee6f3..bc64514ad1bb 100644
> > > > --- a/mm/slub.c
> > > > +++ b/mm/slub.c
> > > > @@ -2890,6 +2890,9 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p)
> > > >  	do {
> > > >  		struct detached_freelist df;
> > > >  
> > > > +		/* Support for memcg */
> > > > +		s = cache_from_obj(s, p[size - 1]);
> > > > +
[...]
> 
> Yeah, after inspecting build_detached_freelist more closely, I see your
> patch is correct.

Actually, my patch is not correct... after spending most of my day
debugging V3 of patch 1/2, I've just realized this patch it the culprit.

We cannot overwrite the original "s", as the second time around the
loop, "s" will be a memcg slab cache.  And then slab_equal_or_root()
cannot find  the "root_cache" (s->memcg_params.root_cache).

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]