Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christoph Lameter and committed by
Linus Torvalds
b811c202 3e26c149

+7 -11
+7 -11
mm/slub.c
··· 1085 1085 1086 1086 BUG_ON(flags & GFP_SLAB_BUG_MASK); 1087 1087 1088 - if (flags & __GFP_WAIT) 1089 - local_irq_enable(); 1090 - 1091 1088 page = allocate_slab(s, 1092 1089 flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); 1093 1090 if (!page) ··· 1117 1120 page->freelist = start; 1118 1121 page->inuse = 0; 1119 1122 out: 1120 - if (flags & __GFP_WAIT) 1121 - local_irq_disable(); 1122 1123 return page; 1123 1124 } 1124 1125 ··· 1500 1505 goto load_freelist; 1501 1506 } 1502 1507 1508 + if (gfpflags & __GFP_WAIT) 1509 + local_irq_enable(); 1510 + 1503 1511 new = new_slab(s, gfpflags, node); 1512 + 1513 + if (gfpflags & __GFP_WAIT) 1514 + local_irq_disable(); 1515 + 1504 1516 if (new) { 1505 1517 c = get_cpu_slab(s, smp_processor_id()); 1506 1518 if (c->page) { ··· 2041 2039 init_kmem_cache_node(n); 2042 2040 atomic_long_inc(&n->nr_slabs); 2043 2041 add_partial(n, page); 2044 - 2045 - /* 2046 - * new_slab() disables interupts. If we do not reenable interrupts here 2047 - * then bootup would continue with interrupts disabled. 2048 - */ 2049 - local_irq_enable(); 2050 2042 return n; 2051 2043 } 2052 2044