Re: [PATCH -mm] slub: fix cpu hotplug offline/online path

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Christoph Lameter <clameter@...>
Cc: <linux-kernel@...>, Andrew Morton <akpm@...>, Pekka Enberg <penberg@...>
Date: Wednesday, October 10, 2007 - 8:18 am

On Tue, Oct 09, 2007 at 11:46:14AM -0700, Christoph Lameter wrote:

I couldn't use get_cpu_slab() for that check. But I reviced the patch to do
what you said.

Subject: slub: fix cpu hotplug offline/online path

This patch fixes the problem introduced by:
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc8/2.6.23-rc8-mm2/b...

I got slub BUG report when I tried to do cpu hotplug/unplug
$ while true; do
	echo 0 > /sys/devices/system/cpu/cpu1/online
	echo 1 > /sys/devices/system/cpu/cpu1/online
done

This is because init_alloc_cpu_cpu() is called every time when the CPU is
going to be onlined but init_alloc_cpu_cpu() is not intented to be called
twice or more for same CPU. Then it breaks kmem_cache_cpu_free list for
the CPU.

This patch checks if a per cpu structure has already been allocated and then
simply skip the call to init_alloc_cpu_cpu().

Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 mm/slub.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: 2.6-mm/mm/slub.c
===================================================================
--- 2.6-mm.orig/mm/slub.c
+++ 2.6-mm/mm/slub.c
@@ -2033,6 +2033,11 @@ static void init_alloc_cpu_cpu(int cpu)
 {
 	int i;
 
+	if (per_cpu(kmem_cache_cpu_free, cpu)) {
+		/* Already initialized once */
+		return;
+	}
+
 	for (i = NR_KMEM_CACHE_CPU - 1; i >= 0; i--)
 		free_kmem_cache_cpu(&per_cpu(kmem_cache_cpu, cpu)[i], cpu);
 }
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -mm] slub: fix cpu hotplug offline/online path, Akinobu Mita, (Tue Oct 9, 12:13 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Tue Oct 9, 2:46 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Akinobu Mita, (Wed Oct 10, 8:18 am)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Wed Oct 10, 1:39 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Akinobu Mita, (Thu Oct 11, 10:36 am)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Thu Oct 11, 1:37 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Thu Oct 11, 12:46 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Thu Oct 11, 1:36 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Tue Oct 9, 2:50 pm)
Re: [PATCH -mm] slub: fix cpu hotplug offline/online path, Christoph Lameter, (Tue Oct 9, 3:15 pm)