Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27390bc3 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds
Browse files

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: default avatarChristoph Lameter <clameter@sgi.com>
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ac140a8f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -2607,6 +2607,19 @@ static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu)
	up_read(&slub_lock);
}

/*
 * Version of __flush_cpu_slab for the case that interrupts
 * are enabled.
 */
static void cpu_slab_flush(struct kmem_cache *s, int cpu)
{
	unsigned long flags;

	local_irq_save(flags);
	__flush_cpu_slab(s, cpu);
	local_irq_restore(flags);
}

/*
 * Use the cpu notifier to insure that the cpu slabs are flushed when
 * necessary.
@@ -2621,7 +2634,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb,
	case CPU_UP_CANCELED_FROZEN:
	case CPU_DEAD:
	case CPU_DEAD_FROZEN:
		for_all_slabs(__flush_cpu_slab, cpu);
		for_all_slabs(cpu_slab_flush, cpu);
		break;
	default:
		break;