public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: kmannth@us.ibm.com, linux-kernel@vger.kernel.org, clameter@engr.sgi.com
Subject: Re: [BUG] i386 2.6.18 cpu_up: attempt to bring up CPU 4 failed : kernel BUG at mm/slab.c:2698!
Date: Thu, 21 Sep 2006 20:08:06 -0700	[thread overview]
Message-ID: <20060921200806.523ce0b2.akpm@osdl.org> (raw)
In-Reply-To: <20060922112427.d5f3aef6.kamezawa.hiroyu@jp.fujitsu.com>

On Fri, 22 Sep 2006 11:24:27 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Thu, 21 Sep 2006 18:34:03 -0700
> keith mannthey <kmannth@us.ibm.com> wrote:
> 
> > That unhappy caller in the chain is cpuup_callback in mm/slab.c.  I am
> > still working out as to why, there is a lot going on if this function. 
> > 
> > > b) pageset_cpuup_callback()'s CPU_UP_CANCELED path possibly hasn't been
> > >    tested before.  I'd be guessing that we're not zeroing out the
> > >    zone.pageset[] array when the `struct zone' is first allocated, but I
> > >    don't immediately recall where that code lives.
> > 
> 
> How about here ?
> == at boot time in mm/page_alloc.c ==
> free_area_init_core()
> 	->zone_pcp_init(zone);
>         for (cpu = 0; cpu < NR_CPUS; cpu++) {
> #ifdef CONFIG_NUMA
>                 /* Early boot. Slab allocator not functional yet */
>                 zone_pcp(zone, cpu) = &boot_pageset[cpu];
>                 setup_pageset(&boot_pageset[cpu],0);
> #else
>                 setup_pageset(zone_pcp(zone,cpu), batch);
> #endif
>         }
> ==================
> 
> Not zero-cleared.
> 

Actually, I'd point the finger at process_zones().  If that kmalloc()
fails, we leave garbage in the entries for the remaining zones.  But
free_zone_pagesets() kfrees all of them, uncluding the garbage pointers.

So something like...

--- a/mm/page_alloc.c~a
+++ a/mm/page_alloc.c
@@ -1811,11 +1811,14 @@ static struct per_cpu_pageset boot_pages
  */
 static int __cpuinit process_zones(int cpu)
 {
-	struct zone *zone, *dzone;
+	struct zone *zone;
 
-	for_each_zone(zone) {
+	for_each_zone(zone)
+		zone_pcp(zone, cpu) = NULL;
 
-		zone_pcp(zone, cpu) = kmalloc_node(sizeof(struct per_cpu_pageset),
+	for_each_zone(zone) {
+		zone_pcp(zone, cpu) =
+			kmalloc_node(sizeof(struct per_cpu_pageset),
 					 GFP_KERNEL, cpu_to_node(cpu));
 		if (!zone_pcp(zone, cpu))
 			goto bad;
@@ -1824,17 +1827,16 @@ static int __cpuinit process_zones(int c
 
 		if (percpu_pagelist_fraction)
 			setup_pagelist_highmark(zone_pcp(zone, cpu),
-			 	(zone->present_pages / percpu_pagelist_fraction));
+			    (zone->present_pages / percpu_pagelist_fraction));
 	}
 
 	return 0;
 bad:
-	for_each_zone(dzone) {
-		if (dzone == zone)
-			break;
-		kfree(zone_pcp(dzone, cpu));
-		zone_pcp(dzone, cpu) = NULL;
+	for_each_zone(zone) {
+		kfree(zone_pcp(zone, cpu));
+		zone_pcp(zone, cpu) = NULL;
 	}
+	printk(KERN_EMERG "%s: kmalloc() failed\n", __FUNCTION__);
 	return -ENOMEM;
 }
 
_


But why did the kmalloc() fail?


  reply	other threads:[~2006-09-22  3:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22  0:17 [BUG] i386 2.6.18 cpu_up: attempt to bring up CPU 4 failed : kernel BUG at mm/slab.c:2698! keith mannthey
2006-09-22  0:41 ` Andrew Morton
2006-09-22  1:34   ` keith mannthey
2006-09-22  2:09     ` KAMEZAWA Hiroyuki
2006-09-22  2:24     ` KAMEZAWA Hiroyuki
2006-09-22  3:08       ` Andrew Morton [this message]
2006-09-22  3:30         ` KAMEZAWA Hiroyuki
2006-09-22  3:38           ` David Rientjes
2006-09-22  3:42           ` Andrew Morton
2006-09-22  3:46           ` Andrew Morton
2006-09-22  4:09             ` David Rientjes
2006-09-22 18:20               ` [PATCH] do not free non slab allocated per_cpu_pageset David Rientjes
2006-09-22 18:22                 ` Christoph Lameter
2006-09-22 18:39                 ` Andrew Morton
2006-09-22 18:43                   ` Christoph Lameter
2006-09-22 18:56                     ` Andrew Morton
2006-09-22 19:06                       ` Christoph Lameter
2006-09-22 19:10                         ` David Rientjes
2006-09-22 19:44               ` [BUG] i386 2.6.18 cpu_up: attempt to bring up CPU 4 failed : kernel BUG at mm/slab.c:2698! keith mannthey
2006-09-23  5:19                 ` Andrew Morton
2006-09-22  2:31     ` keith mannthey

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=20060921200806.523ce0b2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=clameter@engr.sgi.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kmannth@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox