From 34ab8917511724f3aeb3b6982f4faf3cc1012eb8 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Thu, 23 Mar 2006 03:01:04 -0800 Subject: [PATCH] --- yaml --- r: 23088 b: refs/heads/master c: 63872f87a151413100678f110d1556026002809e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/init/main.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index e7c9692a439f..30999a24dca7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a6b7951bfcca7f45f44269ea87417c74558daf8 +refs/heads/master: 63872f87a151413100678f110d1556026002809e diff --git a/trunk/init/main.c b/trunk/init/main.c index 141e8896d252..9cf6b307bfd7 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -333,6 +333,7 @@ static void __init setup_per_cpu_areas(void) { unsigned long size, i; char *ptr; + unsigned long nr_possible_cpus = num_possible_cpus(); /* Copy section for each CPU (we discard the original) */ size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); @@ -340,12 +341,16 @@ static void __init setup_per_cpu_areas(void) if (size < PERCPU_ENOUGH_ROOM) size = PERCPU_ENOUGH_ROOM; #endif + ptr = alloc_bootmem(size * nr_possible_cpus); - ptr = alloc_bootmem(size * NR_CPUS); - - for (i = 0; i < NR_CPUS; i++, ptr += size) { + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_possible(i)) { + __per_cpu_offset[i] = (char*)0 - __per_cpu_start; + continue; + } __per_cpu_offset[i] = ptr - __per_cpu_start; memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); + ptr += size; } } #endif /* !__GENERIC_PER_CPU */