Re: [rfc 06/18] slub: Use page variable instead of c->page.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 11, 2011 at 10:07 PM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> The kmem_cache_cpu object pointed to by c will become
> volatile with the lockless patches later so extract
> the c->page pointer at certain times.
>
> Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

I don't know what GCC does these days but this sort of thing used to
generate better asm in mm/slab.c. So it might be worth it to merge
this.

> ---
>  mm/slub.c |   17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c    2011-11-09 11:11:25.881561697 -0600
> +++ linux-2.6/mm/slub.c 2011-11-09 11:11:32.231598204 -0600
> @@ -2160,6 +2160,7 @@ static void *__slab_alloc(struct kmem_ca
>                          unsigned long addr, struct kmem_cache_cpu *c)
>  {
>        void *freelist;
> +       struct page *page;
>        unsigned long flags;
>
>        local_irq_save(flags);
> @@ -2172,13 +2173,14 @@ static void *__slab_alloc(struct kmem_ca
>        c = this_cpu_ptr(s->cpu_slab);
>  #endif
>
> -       if (!c->page)
> +       page = c->page;
> +       if (!page)
>                goto new_slab;
>  redo:
>
>        if (unlikely(!node_match(c, node))) {
>                stat(s, ALLOC_NODE_MISMATCH);
> -               deactivate_slab(s, c->page, c->freelist);
> +               deactivate_slab(s, page, c->freelist);
>                c->page = NULL;
>                c->freelist = NULL;
>                goto new_slab;
> @@ -2186,7 +2188,7 @@ redo:
>
>        stat(s, ALLOC_SLOWPATH);
>
> -       freelist = get_freelist(s, c->page);
> +       freelist = get_freelist(s, page);
>
>        if (unlikely(!freelist)) {
>                c->page = NULL;
> @@ -2210,8 +2212,8 @@ load_freelist:
>  new_slab:
>
>        if (c->partial) {
> -               c->page = c->partial;
> -               c->partial = c->page->next;
> +               page = c->page = c->partial;
> +               c->partial = page->next;
>                stat(s, CPU_PARTIAL_ALLOC);
>                c->freelist = NULL;
>                goto redo;
> @@ -2231,13 +2233,14 @@ new_slab:
>                return NULL;
>        }
>
> +       page = c->page;
>        if (likely(!kmem_cache_debug(s)))
>                goto load_freelist;
>
>        /* Only entered in the debug case */
> -       if (!alloc_debug_processing(s, c->page, freelist, addr))
> +       if (!alloc_debug_processing(s, page, freelist, addr))
>                goto new_slab;  /* Slab failed checks. Next slab needed */
> -       deactivate_slab(s, c->page, get_freepointer(s, freelist));
> +       deactivate_slab(s, page, get_freepointer(s, freelist));
>
>        c->page = NULL;
>        c->freelist = NULL;
>
> --
> 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/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]