From: Pekka Enberg <penberg@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>,
Andi Kleen <andi@firstfloor.org>,
tj@kernel.org, Metathronius Galabant <m.galabant@googlemail.com>,
Matt Mackall <mpm@selenic.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
Adrian Drzewiecki <z@drze.net>, Shaohua Li <shaohua.li@intel.com>,
Alex Shi <alex.shi@intel.com>,
linux-mm@kvack.org
Subject: Re: [rfc 04/18] slub: Use freelist instead of "object" in __slab_alloc
Date: Mon, 14 Nov 2011 23:44:19 +0200 [thread overview]
Message-ID: <CAOJsxLGtWD=gojcASCH0s04qenARMj4xHFo3z8zSUKEzV-Mm9Q@mail.gmail.com> (raw)
In-Reply-To: <20111111200727.668158433@linux.com>
On Fri, Nov 11, 2011 at 10:07 PM, Christoph Lameter <cl@linux.com> wrote:
> The variable "object" really refers to a list of objects that we
> are handling. Since the lockless allocator path will depend on it
> we rename the variable now.
>
> Signed-off-by: Christoph Lameter <cl@linux.com>
Also a reasonable cleanup.
> ---
> mm/slub.c | 40 ++++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 18 deletions(-)
>
> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c 2011-11-09 11:11:13.471490305 -0600
> +++ linux-2.6/mm/slub.c 2011-11-09 11:11:22.381541568 -0600
> @@ -2084,7 +2084,7 @@ slab_out_of_memory(struct kmem_cache *s,
> static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
> int node, struct kmem_cache_cpu **pc)
> {
> - void *object;
> + void *freelist;
> struct kmem_cache_cpu *c;
> struct page *page = new_slab(s, flags, node);
>
> @@ -2097,16 +2097,16 @@ static inline void *new_slab_objects(str
> * No other reference to the page yet so we can
> * muck around with it freely without cmpxchg
> */
> - object = page->freelist;
> + freelist = page->freelist;
> page->freelist = NULL;
>
> stat(s, ALLOC_SLAB);
> c->page = page;
> *pc = c;
> } else
> - object = NULL;
> + freelist = NULL;
>
> - return object;
> + return freelist;
> }
>
> /*
> @@ -2159,7 +2159,7 @@ static inline void *get_freelist(struct
> static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
> unsigned long addr, struct kmem_cache_cpu *c)
> {
> - void **object;
> + void *freelist;
> unsigned long flags;
>
> local_irq_save(flags);
> @@ -2175,6 +2175,7 @@ static void *__slab_alloc(struct kmem_ca
> if (!c->page)
> goto new_slab;
> redo:
> +
> if (unlikely(!node_match(c, node))) {
> stat(s, ALLOC_NODE_MISMATCH);
> deactivate_slab(s, c->page, c->freelist);
> @@ -2185,9 +2186,9 @@ redo:
>
> stat(s, ALLOC_SLOWPATH);
>
> - object = get_freelist(s, c->page);
> + freelist = get_freelist(s, c->page);
>
> - if (!object) {
> + if (unlikely(!freelist)) {
> c->page = NULL;
> stat(s, DEACTIVATE_BYPASS);
> goto new_slab;
> @@ -2196,10 +2197,15 @@ redo:
> stat(s, ALLOC_REFILL);
>
> load_freelist:
> - c->freelist = get_freepointer(s, object);
> + /*
> + * freelist is pointing to the list of objects to be used.
> + * page is pointing to the page from which the objects are obtained.
> + */
> + VM_BUG_ON(!c->page->frozen);
> + c->freelist = get_freepointer(s, freelist);
> c->tid = next_tid(c->tid);
> local_irq_restore(flags);
> - return object;
> + return freelist;
>
> new_slab:
>
> @@ -2211,14 +2217,12 @@ new_slab:
> goto redo;
> }
>
> - /* Then do expensive stuff like retrieving pages from the partial lists */
> - object = get_partial(s, gfpflags, node, c);
> + freelist = get_partial(s, gfpflags, node, c);
>
> - if (unlikely(!object)) {
> + if (unlikely(!freelist)) {
> + freelist = new_slab_objects(s, gfpflags, node, &c);
>
> - object = new_slab_objects(s, gfpflags, node, &c);
> -
> - if (unlikely(!object)) {
> + if (unlikely(!freelist)) {
> if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
> slab_out_of_memory(s, gfpflags, node);
>
> @@ -2231,14 +2235,14 @@ new_slab:
> goto load_freelist;
>
> /* Only entered in the debug case */
> - if (!alloc_debug_processing(s, c->page, object, addr))
> + if (!alloc_debug_processing(s, c->page, freelist, addr))
> goto new_slab; /* Slab failed checks. Next slab needed */
> + deactivate_slab(s, c->page, get_freepointer(s, freelist));
>
> - deactivate_slab(s, c->page, get_freepointer(s, object));
> c->page = NULL;
> c->freelist = NULL;
> local_irq_restore(flags);
> - return object;
> + return freelist;
> }
>
> /*
>
> --
> 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/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-11-14 21:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-11 20:07 [rfc 00/18] slub: irqless/lockless slow allocation paths Christoph Lameter
2011-11-11 20:07 ` [rfc 01/18] slub: Get rid of the node field Christoph Lameter
2011-11-14 21:42 ` Pekka Enberg
2011-11-15 16:07 ` Christoph Lameter
2011-11-20 23:01 ` David Rientjes
2011-11-21 17:17 ` Christoph Lameter
2011-11-11 20:07 ` [rfc 02/18] slub: Separate out kmem_cache_cpu processing from deactivate_slab Christoph Lameter
2011-11-20 23:10 ` David Rientjes
2011-11-11 20:07 ` [rfc 03/18] slub: Extract get_freelist from __slab_alloc Christoph Lameter
2011-11-14 21:43 ` Pekka Enberg
2011-11-15 16:08 ` Christoph Lameter
2011-12-13 20:31 ` Pekka Enberg
2011-11-20 23:18 ` David Rientjes
2011-11-11 20:07 ` [rfc 04/18] slub: Use freelist instead of "object" in __slab_alloc Christoph Lameter
2011-11-14 21:44 ` Pekka Enberg [this message]
2011-11-20 23:22 ` David Rientjes
2011-11-11 20:07 ` [rfc 05/18] slub: Simplify control flow in __slab_alloc() Christoph Lameter
2011-11-14 21:45 ` Pekka Enberg
2011-11-20 23:24 ` David Rientjes
2011-11-11 20:07 ` [rfc 06/18] slub: Use page variable instead of c->page Christoph Lameter
2011-11-14 21:46 ` Pekka Enberg
2011-11-20 23:27 ` David Rientjes
2011-11-11 20:07 ` [rfc 07/18] slub: pass page to node_match() instead of kmem_cache_cpu structure Christoph Lameter
2011-11-20 23:28 ` David Rientjes
2011-11-11 20:07 ` [rfc 08/18] slub: enable use of deactivate_slab with interrupts on Christoph Lameter
2011-11-11 20:07 ` [rfc 09/18] slub: Run deactivate_slab with interrupts enabled Christoph Lameter
2011-11-11 20:07 ` [rfc 10/18] slub: Enable use of get_partial " Christoph Lameter
2011-11-11 20:07 ` [rfc 11/18] slub: Acquire_slab() avoid loop Christoph Lameter
2011-11-11 20:07 ` [rfc 12/18] slub: Remove kmem_cache_cpu dependency from acquire slab Christoph Lameter
2011-11-11 20:07 ` [rfc 13/18] slub: Add functions to manage per cpu freelists Christoph Lameter
2011-11-11 20:07 ` [rfc 14/18] slub: Decomplicate the get_pointer_safe call and fixup statistics Christoph Lameter
2011-11-11 20:07 ` [rfc 15/18] slub: new_slab_objects() can also get objects from partial list Christoph Lameter
2011-11-11 20:07 ` [rfc 16/18] slub: Drop page field from kmem_cache_cpu Christoph Lameter
2011-11-11 20:07 ` [rfc 17/18] slub: Move __slab_free() into slab_free() Christoph Lameter
2011-11-11 20:07 ` [rfc 18/18] slub: Move __slab_alloc() into slab_alloc() Christoph Lameter
2011-11-16 17:39 ` [rfc 00/18] slub: irqless/lockless slow allocation paths Eric Dumazet
2011-11-16 17:45 ` Eric Dumazet
2011-11-20 23:32 ` David Rientjes
2011-11-20 23:30 ` David Rientjes
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='CAOJsxLGtWD=gojcASCH0s04qenARMj4xHFo3z8zSUKEzV-Mm9Q@mail.gmail.com' \
--to=penberg@kernel.org \
--cc=alex.shi@intel.com \
--cc=andi@firstfloor.org \
--cc=cl@linux.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-mm@kvack.org \
--cc=m.galabant@googlemail.com \
--cc=mpm@selenic.com \
--cc=rientjes@google.com \
--cc=shaohua.li@intel.com \
--cc=tj@kernel.org \
--cc=z@drze.net \
/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;
as well as URLs for NNTP newsgroup(s).