Commit 7c04e64a authored by Akinobu Mita's avatar Akinobu Mita Committed by Ingo Molnar

x86: use cpumask function for present, possible, and online cpus

cpu_online(), cpu_present(), for_each_possible_cpu(), num_possible_cpus()
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 877084fb
...@@ -51,7 +51,7 @@ void __init setup_apic_routing(void) ...@@ -51,7 +51,7 @@ void __init setup_apic_routing(void)
else else
#endif #endif
if (cpus_weight(cpu_possible_map) <= 8) if (num_possible_cpus() <= 8)
genapic = &apic_flat; genapic = &apic_flat;
else else
genapic = &apic_physflat; genapic = &apic_physflat;
......
...@@ -1058,7 +1058,7 @@ int __cpuinit native_cpu_up(unsigned int cpu) ...@@ -1058,7 +1058,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
check_tsc_sync_source(cpu); check_tsc_sync_source(cpu);
local_irq_restore(flags); local_irq_restore(flags);
while (!cpu_isset(cpu, cpu_online_map)) { while (!cpu_online(cpu)) {
cpu_relax(); cpu_relax();
touch_nmi_watchdog(); touch_nmi_watchdog();
} }
...@@ -1168,7 +1168,7 @@ static void __init smp_cpu_index_default(void) ...@@ -1168,7 +1168,7 @@ static void __init smp_cpu_index_default(void)
int i; int i;
struct cpuinfo_x86 *c; struct cpuinfo_x86 *c;
for_each_cpu_mask(i, cpu_possible_map) { for_each_possible_cpu(i) {
c = &cpu_data(i); c = &cpu_data(i);
/* mark all to hotplug */ /* mark all to hotplug */
c->cpu_index = NR_CPUS; c->cpu_index = NR_CPUS;
......
...@@ -195,9 +195,9 @@ static int __cpuinit init_smp_flush(void) ...@@ -195,9 +195,9 @@ static int __cpuinit init_smp_flush(void)
{ {
int i; int i;
for_each_cpu_mask(i, cpu_possible_map) { for_each_possible_cpu(i)
spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock); spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock);
}
return 0; return 0;
} }
core_initcall(init_smp_flush); core_initcall(init_smp_flush);
......
...@@ -113,7 +113,7 @@ static inline void send_QIC_CPI(__u32 cpuset, __u8 cpi) ...@@ -113,7 +113,7 @@ static inline void send_QIC_CPI(__u32 cpuset, __u8 cpi)
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
if (cpuset & (1 << cpu)) { if (cpuset & (1 << cpu)) {
#ifdef VOYAGER_DEBUG #ifdef VOYAGER_DEBUG
if (!cpu_isset(cpu, cpu_online_map)) if (!cpu_online(cpu))
VDEBUG(("CPU%d sending cpi %d to CPU%d not in " VDEBUG(("CPU%d sending cpi %d to CPU%d not in "
"cpu_online_map\n", "cpu_online_map\n",
hard_smp_processor_id(), cpi, cpu)); hard_smp_processor_id(), cpi, cpu));
...@@ -683,9 +683,9 @@ void __init smp_boot_cpus(void) ...@@ -683,9 +683,9 @@ void __init smp_boot_cpus(void)
* Code added from smpboot.c */ * Code added from smpboot.c */
{ {
unsigned long bogosum = 0; unsigned long bogosum = 0;
for (i = 0; i < NR_CPUS; i++)
if (cpu_isset(i, cpu_online_map)) for_each_online_cpu(i)
bogosum += cpu_data(i).loops_per_jiffy; bogosum += cpu_data(i).loops_per_jiffy;
printk(KERN_INFO "Total of %d processors activated " printk(KERN_INFO "Total of %d processors activated "
"(%lu.%02lu BogoMIPS).\n", "(%lu.%02lu BogoMIPS).\n",
cpucount + 1, bogosum / (500000 / HZ), cpucount + 1, bogosum / (500000 / HZ),
...@@ -1838,7 +1838,7 @@ static int __cpuinit voyager_cpu_up(unsigned int cpu) ...@@ -1838,7 +1838,7 @@ static int __cpuinit voyager_cpu_up(unsigned int cpu)
return -EIO; return -EIO;
/* Unleash the CPU! */ /* Unleash the CPU! */
cpu_set(cpu, smp_commenced_mask); cpu_set(cpu, smp_commenced_mask);
while (!cpu_isset(cpu, cpu_online_map)) while (!cpu_online(cpu))
mb(); mb();
return 0; return 0;
} }
......
...@@ -193,7 +193,7 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus) ...@@ -193,7 +193,7 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus)
/* Restrict the possible_map according to max_cpus. */ /* Restrict the possible_map according to max_cpus. */
while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--) for (cpu = NR_CPUS - 1; !cpu_possible(cpu); cpu--)
continue; continue;
cpu_clear(cpu, cpu_possible_map); cpu_clear(cpu, cpu_possible_map);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment