From 8f964281cf81b5beced32a3962ad6434a05209fd Mon Sep 17 00:00:00 2001 From: Mike Travis Date: Wed, 26 Mar 2008 14:23:48 -0700 Subject: [PATCH] --- yaml --- r: 91083 b: refs/heads/master c: e0982e90cd1ecf59818b137386b7f63debded9cc h: refs/heads/master i: 91081: 967b6248e903b236eca2c61b4465300c250e4933 91079: eecc984e71cb6c69edc964be96c8431ddad0ff4f v: v3 --- [refs] | 2 +- trunk/init/main.c | 17 +++++++++++++++++ trunk/kernel/sched.c | 7 ------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index fab3b54bb111..5cc54d195d0b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4bdbaad33d0f4d0e9818a38a825f5b75c0296a28 +refs/heads/master: e0982e90cd1ecf59818b137386b7f63debded9cc diff --git a/trunk/init/main.c b/trunk/init/main.c index 2df3f0617fdc..833a67df1f7e 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -359,6 +359,7 @@ static void __init smp_init(void) #endif static inline void setup_per_cpu_areas(void) { } +static inline void setup_nr_cpu_ids(void) { } static inline void smp_prepare_cpus(unsigned int maxcpus) { } #else @@ -368,6 +369,21 @@ cpumask_t cpu_mask_all __read_mostly = CPU_MASK_ALL; EXPORT_SYMBOL(cpu_mask_all); #endif +/* Setup number of possible processor ids */ +int nr_cpu_ids __read_mostly = NR_CPUS; +EXPORT_SYMBOL(nr_cpu_ids); + +/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */ +static void __init setup_nr_cpu_ids(void) +{ + int cpu, highest_cpu = 0; + + for_each_possible_cpu(cpu) + highest_cpu = cpu; + + nr_cpu_ids = highest_cpu + 1; +} + #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; @@ -542,6 +558,7 @@ asmlinkage void __init start_kernel(void) setup_command_line(command_line); unwind_setup(); setup_per_cpu_areas(); + setup_nr_cpu_ids(); smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ /* diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index b56d98b01267..6ab0fcbf26e9 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -6116,10 +6116,6 @@ void __init migration_init(void) #ifdef CONFIG_SMP -/* Number of possible processor ids */ -int nr_cpu_ids __read_mostly = NR_CPUS; -EXPORT_SYMBOL(nr_cpu_ids); - #ifdef CONFIG_SCHED_DEBUG static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, @@ -7478,7 +7474,6 @@ static void init_tg_rt_entry(struct rq *rq, struct task_group *tg, void __init sched_init(void) { - int highest_cpu = 0; int i, j; unsigned long alloc_size = 0, ptr; @@ -7569,7 +7564,6 @@ void __init sched_init(void) #endif init_rq_hrtick(rq); atomic_set(&rq->nr_iowait, 0); - highest_cpu = i; } set_load_weight(&init_task); @@ -7579,7 +7573,6 @@ void __init sched_init(void) #endif #ifdef CONFIG_SMP - nr_cpu_ids = highest_cpu + 1; open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL); #endif