diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-06-01 03:47:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-01 11:18:30 -0400 |
commit | 27390bc335ff86d92c3819cc28035fde23d1a9c2 (patch) | |
tree | 2812436fe897a1211c244f85db2a4d79fff673ff | |
parent | ac140a8f8396504b33ddafb7309feca77bff8497 (diff) |
SLUB: fix locking for hotplug callbacks
Hotplug callbacks are performed with interrupts enabled. Slub requires
interrupts to be disabled for flushing caches.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/slub.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -2608,6 +2608,19 @@ static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu) | |||
2608 | } | 2608 | } |
2609 | 2609 | ||
2610 | /* | 2610 | /* |
2611 | * Version of __flush_cpu_slab for the case that interrupts | ||
2612 | * are enabled. | ||
2613 | */ | ||
2614 | static void cpu_slab_flush(struct kmem_cache *s, int cpu) | ||
2615 | { | ||
2616 | unsigned long flags; | ||
2617 | |||
2618 | local_irq_save(flags); | ||
2619 | __flush_cpu_slab(s, cpu); | ||
2620 | local_irq_restore(flags); | ||
2621 | } | ||
2622 | |||
2623 | /* | ||
2611 | * Use the cpu notifier to insure that the cpu slabs are flushed when | 2624 | * Use the cpu notifier to insure that the cpu slabs are flushed when |
2612 | * necessary. | 2625 | * necessary. |
2613 | */ | 2626 | */ |
@@ -2621,7 +2634,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb, | |||
2621 | case CPU_UP_CANCELED_FROZEN: | 2634 | case CPU_UP_CANCELED_FROZEN: |
2622 | case CPU_DEAD: | 2635 | case CPU_DEAD: |
2623 | case CPU_DEAD_FROZEN: | 2636 | case CPU_DEAD_FROZEN: |
2624 | for_all_slabs(__flush_cpu_slab, cpu); | 2637 | for_all_slabs(cpu_slab_flush, cpu); |
2625 | break; | 2638 | break; |
2626 | default: | 2639 | default: |
2627 | break; | 2640 | break; |