Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932620AbbFIAZW (ORCPT ); Mon, 8 Jun 2015 20:25:22 -0400 Received: from lgeamrelo02.lge.com ([156.147.1.126]:58578 "EHLO lgeamrelo02.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932201AbbFIAZI (ORCPT ); Mon, 8 Jun 2015 20:25:08 -0400 X-Original-SENDERIP: 10.177.222.220 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Date: Tue, 9 Jun 2015 09:26:39 +0900 From: Joonsoo Kim To: linux-kernel@vger.kernel.org Cc: cl@linux.com, brouer@redhat.com, penberg@kernel.org, rientjes@google.com, mm-commits@vger.kernel.org Subject: Re: + slub-bulk-alloc-extract-objects-from-the-per-cpu-slab.patch added to -mm tree Message-ID: <20150609002639.GB9687@js1304-P5Q-DELUXE> References: <5525b159.BpuUD6FQt89EaGh/%akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5525b159.BpuUD6FQt89EaGh/%akpm@linux-foundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3611 Lines: 98 On Wed, Apr 08, 2015 at 03:53:13PM -0700, akpm@linux-foundation.org wrote: > > The patch titled > Subject: slub bulk alloc: extract objects from the per cpu slab > has been added to the -mm tree. Its filename is > slub-bulk-alloc-extract-objects-from-the-per-cpu-slab.patch > > This patch should soon appear at > http://ozlabs.org/~akpm/mmots/broken-out/slub-bulk-alloc-extract-objects-from-the-per-cpu-slab.patch > and later at > http://ozlabs.org/~akpm/mmotm/broken-out/slub-bulk-alloc-extract-objects-from-the-per-cpu-slab.patch > > Before you just go and hit "reply", please: > a) Consider who else should be cc'ed > b) Prefer to cc a suitable mailing list as well > c) Ideally: find the original patch on the mailing list and do a > reply-to-all to that, adding suitable additional cc's > > *** Remember to use Documentation/SubmitChecklist when testing your code *** > > The -mm tree is included into linux-next and is updated > there every 3-4 working days > > ------------------------------------------------------ > From: Christoph Lameter > Subject: slub bulk alloc: extract objects from the per cpu slab > > First piece: acceleration of retrieval of per cpu objects > > If we are allocating lots of objects then it is advantageous to disable > interrupts and avoid the this_cpu_cmpxchg() operation to get these objects > faster. Note that we cannot do the fast operation if debugging is > enabled. Note also that the requirement of having interrupts disabled > avoids having to do processor flag operations. > > Allocate as many objects as possible in the fast way and then fall back to > the generic implementation for the rest of the objects. > > Signed-off-by: Christoph Lameter > Cc: Jesper Dangaard Brouer > Cc: Christoph Lameter > Cc: Pekka Enberg > Cc: David Rientjes > Cc: Joonsoo Kim > Signed-off-by: Andrew Morton > --- > > mm/slub.c | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff -puN mm/slub.c~slub-bulk-alloc-extract-objects-from-the-per-cpu-slab mm/slub.c > --- a/mm/slub.c~slub-bulk-alloc-extract-objects-from-the-per-cpu-slab > +++ a/mm/slub.c > @@ -2759,7 +2759,32 @@ EXPORT_SYMBOL(kmem_cache_free_bulk); > bool kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, > void **p) > { > - return kmem_cache_alloc_bulk(s, flags, size, p); > + if (!kmem_cache_debug(s)) { > + struct kmem_cache_cpu *c; > + > + /* Drain objects in the per cpu slab */ > + local_irq_disable(); > + c = this_cpu_ptr(s->cpu_slab); > + > + while (size) { > + void *object = c->freelist; > + > + if (!object) > + break; > + > + c->freelist = get_freepointer(s, object); > + *p++ = object; > + size--; > + > + if (unlikely(flags & __GFP_ZERO)) > + memset(object, 0, s->object_size); > + } > + c->tid = next_tid(c->tid); > + > + local_irq_enable(); > + } > + > + return __kmem_cache_alloc_bulk(s, flags, size, p); Hello, So, if __kmem_cache_alloc_bulk() fails, all allocated objects in array should be freed, but, __kmem_cache_alloc_bulk() can't know about objects allocated by this slub specific kmem_cache_alloc_bulk() function. Please fix it. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/