Re: SLUB regression in current Linus

From: Christoph Lameter
Date: Wed May 25 2011 - 10:25:21 EST


On Tue, 24 May 2011, Linus Torvalds wrote:

> Look at __slab_alloc: we have:
>
>
> page = c->page;
> if (!page)
> goto new_slab;
>
> slab_lock(page);
> if (unlikely(!node_match(c, node)))
> goto another_slab;
>
> and let's assume we have two users racing on that "c->page". The
> "slab_lock()" is going to work for one of them, right?

There cannot be two users racing through this code segment since we have
interrupts disabled and c is pointing to a per cpu structure. c->page
points to a page that can only be allocated from from the current
processor (from the freelist in c->freelist) but it can be freed to from
multiple cpus (via the page->freelist). The code that you are discussing
is copying the freed objects from the page->freelist to the per cpu
freelist and it needs to lock out the slab_free path to do that.


--
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/