From: Christoph Lameter <cl@linux.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: brouer@redhat.com, Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org
Subject: slub: bulk allocation from per cpu partial pages
Date: Thu, 9 Apr 2015 12:16:23 -0500 (CDT) [thread overview]
Message-ID: <alpine.DEB.2.11.1504091215330.18198@gentwo.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1504090859560.19278@gentwo.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 <cl@linux.com>
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-04-09 17:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 18:13 slub bulk alloc: Extract objects from the per cpu slab Christoph Lameter
2015-04-08 22:53 ` Andrew Morton
2015-04-09 14:03 ` Christoph Lameter
2015-04-09 17:16 ` Christoph Lameter [this message]
2015-04-16 12:06 ` slub: bulk allocation from per cpu partial pages Jesper Dangaard Brouer
2015-04-16 15:54 ` Christoph Lameter
2015-04-17 5:44 ` Jesper Dangaard Brouer
2015-04-17 6:06 ` Jesper Dangaard Brouer
2015-04-30 18:40 ` Christoph Lameter
2015-04-30 19:20 ` Jesper Dangaard Brouer
2015-04-09 20:19 ` slub bulk alloc: Extract objects from the per cpu slab Andrew Morton
2015-04-11 2:19 ` Christoph Lameter
2015-04-11 7:25 ` Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.11.1504091215330.18198@gentwo.org \
--to=cl@linux.com \
--cc=akpm@linux-foundation.org \
--cc=brouer@redhat.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox