SLUB: simplify IRQ off handling
Move irq handling out of new slab into __slab_alloc. That is useful for Mathieu's cmpxchg_local patchset and also allows us to remove the crude local_irq_off in early_kmem_cache_alloc(). Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
3e26c149c3
commit
b811c202a0
18
mm/slub.c
18
mm/slub.c
@@ -1085,9 +1085,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
|
|||||||
|
|
||||||
BUG_ON(flags & GFP_SLAB_BUG_MASK);
|
BUG_ON(flags & GFP_SLAB_BUG_MASK);
|
||||||
|
|
||||||
if (flags & __GFP_WAIT)
|
|
||||||
local_irq_enable();
|
|
||||||
|
|
||||||
page = allocate_slab(s,
|
page = allocate_slab(s,
|
||||||
flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
|
flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
|
||||||
if (!page)
|
if (!page)
|
||||||
@@ -1120,8 +1117,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
|
|||||||
page->freelist = start;
|
page->freelist = start;
|
||||||
page->inuse = 0;
|
page->inuse = 0;
|
||||||
out:
|
out:
|
||||||
if (flags & __GFP_WAIT)
|
|
||||||
local_irq_disable();
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1505,7 +1500,14 @@ new_slab:
|
|||||||
goto load_freelist;
|
goto load_freelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gfpflags & __GFP_WAIT)
|
||||||
|
local_irq_enable();
|
||||||
|
|
||||||
new = new_slab(s, gfpflags, node);
|
new = new_slab(s, gfpflags, node);
|
||||||
|
|
||||||
|
if (gfpflags & __GFP_WAIT)
|
||||||
|
local_irq_disable();
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
c = get_cpu_slab(s, smp_processor_id());
|
c = get_cpu_slab(s, smp_processor_id());
|
||||||
if (c->page) {
|
if (c->page) {
|
||||||
@@ -2039,12 +2041,6 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags,
|
|||||||
init_kmem_cache_node(n);
|
init_kmem_cache_node(n);
|
||||||
atomic_long_inc(&n->nr_slabs);
|
atomic_long_inc(&n->nr_slabs);
|
||||||
add_partial(n, page);
|
add_partial(n, page);
|
||||||
|
|
||||||
/*
|
|
||||||
* new_slab() disables interupts. If we do not reenable interrupts here
|
|
||||||
* then bootup would continue with interrupts disabled.
|
|
||||||
*/
|
|
||||||
local_irq_enable();
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user