diff options
author | Christoph Lameter <clameter@engr.sgi.com> | 2007-05-06 17:48:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:51 -0400 |
commit | 476f35348eb8d2a827765992899fea78b7dcc46f (patch) | |
tree | 81dbace9de3d4ffa3ecc67bffe265134962117bd /init/main.c | |
parent | aee16b3cee2746880e40945a9b5bff4f309cfbc4 (diff) |
Safer nr_node_ids and nr_node_ids determination and initial values
The nr_cpu_ids value is currently only calculated in smp_init. However, it
may be needed before (SLUB needs it on kmem_cache_init!) and other kernel
components may also want to allocate dynamically sized per cpu array before
smp_init. So move the determination of possible cpus into sched_init()
where we already loop over all possible cpus early in boot.
Also initialize both nr_node_ids and nr_cpu_ids with the highest value they
could take. If we have accidental users before these values are determined
then the current valud of 0 may cause too small per cpu and per node arrays
to be allocated. If it is set to the maximum possible then we only waste
some memory for early boot users.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/init/main.c b/init/main.c index df982ff5d2b0..0e22f40487bb 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -384,11 +384,6 @@ static void __init setup_per_cpu_areas(void) | |||
384 | static void __init smp_init(void) | 384 | static void __init smp_init(void) |
385 | { | 385 | { |
386 | unsigned int cpu; | 386 | unsigned int cpu; |
387 | unsigned highest = 0; | ||
388 | |||
389 | for_each_cpu_mask(cpu, cpu_possible_map) | ||
390 | highest = cpu; | ||
391 | nr_cpu_ids = highest + 1; | ||
392 | 387 | ||
393 | /* FIXME: This should be done in userspace --RR */ | 388 | /* FIXME: This should be done in userspace --RR */ |
394 | for_each_present_cpu(cpu) { | 389 | for_each_present_cpu(cpu) { |