aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-10-17 02:25:51 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:45 -0400
commitb811c202a0edadaac7242ab834fe7ba409978ae7 (patch)
tree339a29474e6b1abfd5c172bbe57484e5569d8b7e /mm
parent3e26c149c358529b1605f8959341d34bc4b880a3 (diff)
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/mm/slub.c b/mm/slub.c
index f426f9bc644b..0f862fbd344b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1085,9 +1085,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
1085 1085
1086 BUG_ON(flags & GFP_SLAB_BUG_MASK); 1086 BUG_ON(flags & GFP_SLAB_BUG_MASK);
1087 1087
1088 if (flags & __GFP_WAIT)
1089 local_irq_enable();
1090
1091 page = allocate_slab(s, 1088 page = allocate_slab(s,
1092 flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); 1089 flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
1093 if (!page) 1090 if (!page)
@@ -1120,8 +1117,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
1120 page->freelist = start; 1117 page->freelist = start;
1121 page->inuse = 0; 1118 page->inuse = 0;
1122out: 1119out:
1123 if (flags & __GFP_WAIT)
1124 local_irq_disable();
1125 return page; 1120 return page;
1126} 1121}
1127 1122
@@ -1505,7 +1500,14 @@ new_slab:
1505 goto load_freelist; 1500 goto load_freelist;
1506 } 1501 }
1507 1502
1503 if (gfpflags & __GFP_WAIT)
1504 local_irq_enable();
1505
1508 new = new_slab(s, gfpflags, node); 1506 new = new_slab(s, gfpflags, node);
1507
1508 if (gfpflags & __GFP_WAIT)
1509 local_irq_disable();
1510
1509 if (new) { 1511 if (new) {
1510 c = get_cpu_slab(s, smp_processor_id()); 1512 c = get_cpu_slab(s, smp_processor_id());
1511 if (c->page) { 1513 if (c->page) {
@@ -2039,12 +2041,6 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags,
2039 init_kmem_cache_node(n); 2041 init_kmem_cache_node(n);
2040 atomic_long_inc(&n->nr_slabs); 2042 atomic_long_inc(&n->nr_slabs);
2041 add_partial(n, page); 2043 add_partial(n, page);
2042
2043 /*
2044 * new_slab() disables interupts. If we do not reenable interrupts here
2045 * then bootup would continue with interrupts disabled.
2046 */
2047 local_irq_enable();
2048 return n; 2044 return n;
2049} 2045}
2050 2046