From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by kanga.kvack.org (Postfix) with ESMTP id 5C5946B0038 for ; Thu, 9 Apr 2015 13:16:26 -0400 (EDT) Received: by igblo3 with SMTP id lo3so72482761igb.1 for ; Thu, 09 Apr 2015 10:16:26 -0700 (PDT) Received: from resqmta-ch2-09v.sys.comcast.net (resqmta-ch2-09v.sys.comcast.net. [2001:558:fe21:29:69:252:207:41]) by mx.google.com with ESMTPS id cy5si7842726igc.53.2015.04.09.10.16.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 Apr 2015 10:16:25 -0700 (PDT) Date: Thu, 9 Apr 2015 12:16:23 -0500 (CDT) From: Christoph Lameter Subject: slub: bulk allocation from per cpu partial pages In-Reply-To: Message-ID: References: <20150408155304.4480f11f16b60f09879c350d@linux-foundation.org> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: brouer@redhat.com, Joonsoo Kim , Pekka Enberg , David Rientjes , linux-mm@kvack.org Next step: cover all of the per cpu objects available. Expand the bulk allocation support to drain the per cpu partial pages while interrupts are off. Signed-off-by: Christoph Lameter Index: linux/mm/slub.c =================================================================== --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -2771,15 +2771,45 @@ bool kmem_cache_alloc_bulk(struct kmem_c while (size) { void *object = c->freelist; - if (!object) - break; + if (unlikely(!object)) { + /* + * Check if there remotely freed objects + * availalbe in the page. + */ + object = get_freelist(s, c->page); + + if (!object) { + /* + * All objects in use lets check if + * we have other per cpu partial + * pages that have available + * objects. + */ + c->page = c->partial; + if (!c->page) { + /* No per cpu objects left */ + c->freelist = NULL; + break; + } + + /* Next per cpu partial page */ + c->partial = c->page->next; + c->freelist = get_freelist(s, + c->page); + continue; + } + + } + - c->freelist = get_freepointer(s, object); *p++ = object; size--; if (unlikely(flags & __GFP_ZERO)) memset(object, 0, s->object_size); + + c->freelist = get_freepointer(s, object); + } c->tid = next_tid(c->tid); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org