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> > > mm/slub.c | 3 +++ > 1 file changed, 3 insertions(+) > > 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]); > + AFAIU all objects in the array should come from the same cache (should they?), so it should be enough to call this only once: diff --git a/mm/slub.c b/mm/slub.c index 438ebf8bbab1..a6c3c058ce7c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2887,6 +2887,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) if (WARN_ON(!size)) return; + s = cache_from_obj(s, *p); do { struct detached_freelist df; Thanks, Vladimir > size = build_detached_freelist(s, size, p, &df); > if (unlikely(!df.page)) > continue; > -- 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>