Re: [patch] mm/slub: Move slab initialization into irq enabled region

From: Steven Rostedt
Date: Fri Jul 10 2015 - 11:03:13 EST


On Fri, 10 Jul 2015 12:07:13 -0000
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:


> /*
> * Slab allocation and freeing
> */
> @@ -1336,6 +1347,8 @@ static struct page *allocate_slab(struct
> struct page *page;
> struct kmem_cache_order_objects oo = s->oo;
> gfp_t alloc_gfp;
> + void *start, *p;
> + int idx, order;
>
> flags &= gfp_allowed_mask;
>
> @@ -1364,8 +1377,11 @@ static struct page *allocate_slab(struct
> stat(s, ORDER_FALLBACK);
> }
>
> - if (kmemcheck_enabled && page
> - && !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
> + if (!page)
> + goto out;

Since the above now looks like this:

page = alloc_slab_page(s, alloc_gfp, node, oo);
if (unlikely(!page)) {
oo = s->min;
alloc_gfp = flags;
/*
* Allocation may have failed due to fragmentation.
* Try a lower order alloc if possible
*/
page = alloc_slab_page(s, alloc_gfp, node, oo);

if (page)
stat(s, ORDER_FALLBACK);
}

if (!page)
goto out;

Why not have it do this:

page = alloc_slab_page(s, alloc_gfp, node, oo);
if (unlikely(!page)) {
oo = s->min;
alloc_gfp = flags;
/*
* Allocation may have failed due to fragmentation.
* Try a lower order alloc if possible
*/
page = alloc_slab_page(s, alloc_gfp, node, oo);
if (unlikely(!page))
goto out;

stat(s, ORDER_FALLBACK);
}

And get rid of the double check for !page in the fast path.

-- Steve


> +
> + if (kmemcheck_enabled &&
> + !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
> int pages = 1 << oo_order(oo);
>
> kmemcheck_alloc_shadow(page, oo_order(oo), alloc_gfp, node);
> @@ -1380,51 +1396,12 @@ static struct page *allocate_slab(struct
> kmemcheck_mark_unallocated_pages(page, pages);
> }
>
> - if (flags & __GFP_WAIT)
> - local_irq_disable();
> if (!page)
> - return NULL;
> + goto out;
>
> page->objects = oo_objects(oo);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/