All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Christoph Lameter <clameter@sgi.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH -mm] slub: fix cpu hotplug offline/online path
Date: Wed, 10 Oct 2007 01:13:28 +0900	[thread overview]
Message-ID: <20071009161328.GA6470@APFDCB5C> (raw)

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/broken-out/slub-place-kmem_cache_cpu-structures-in-a-numa-aware-way.patch

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 removes init_alloc_cpu_cpu() from cpu hotplug notifier. But
call it for each possible CPUs not only online CPUs at initialization time.

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

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

Index: 2.6-mm/mm/slub.c
===================================================================
--- 2.6-mm.orig/mm/slub.c
+++ 2.6-mm/mm/slub.c
@@ -2029,7 +2029,7 @@ static int alloc_kmem_cache_cpus(struct 
 /*
  * Initialize the per cpu array.
  */
-static void init_alloc_cpu_cpu(int cpu)
+static void __init init_alloc_cpu_cpu(int cpu)
 {
 	int i;
 
@@ -2041,7 +2041,7 @@ static void __init init_alloc_cpu(void)
 {
 	int cpu;
 
-	for_each_online_cpu(cpu)
+	for_each_possible_cpu(cpu)
 		init_alloc_cpu_cpu(cpu);
   }
 
@@ -2973,7 +2973,6 @@ static int __cpuinit slab_cpuup_callback
 	switch (action) {
 	case CPU_UP_PREPARE:
 	case CPU_UP_PREPARE_FROZEN:
-		init_alloc_cpu_cpu(cpu);
 		down_read(&slub_lock);
 		list_for_each_entry(s, &slab_caches, list)
 			s->cpu_slab[cpu] = alloc_kmem_cache_cpu(s, cpu,

             reply	other threads:[~2007-10-09 16:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 16:13 Akinobu Mita [this message]
2007-10-09 17:41 ` [PATCH -mm] slub: fix cpu hotplug offline/online path Pekka Enberg
2007-10-09 18:46 ` Christoph Lameter
2007-10-09 18:48   ` Pekka Enberg
2007-10-09 18:50     ` Christoph Lameter
2007-10-09 19:02       ` Pekka Enberg
2007-10-09 19:15         ` Christoph Lameter
2007-10-10 12:18   ` Akinobu Mita
2007-10-10 17:39     ` Christoph Lameter
2007-10-11 14:36       ` Akinobu Mita
2007-10-11 16:46         ` Christoph Lameter
2007-10-11 17:24           ` Akinobu Mita
2007-10-11 17:36             ` Christoph Lameter
2007-10-11 17:37         ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071009161328.GA6470@APFDCB5C \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.