summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c10
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/sched.c6
-rw-r--r--kernel/timer.c2
4 files changed, 14 insertions, 6 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index a2e44b4e7df1..72b984c67eb3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -20,6 +20,14 @@
DECLARE_MUTEX(cpucontrol);
static struct notifier_block *cpu_chain;
+/*
+ * Represents all cpu's present in the system
+ * In systems capable of hotplug, this map could dynamically grow
+ * as new cpu's are detected in the system via any platform specific
+ * method, such as ACPI for e.g.
+ */
+cpumask_t cpu_present_map;
+EXPORT_SYMBOL(cpu_present_map);
/* Need to know about CPUs going up/down? */
int register_cpu_notifier(struct notifier_block *nb)
@@ -180,7 +188,7 @@ int __devinit cpu_up(unsigned int cpu)
if ((ret = down_interruptible(&cpucontrol)) != 0)
return ret;
- if (cpu_online(cpu)) {
+ if (cpu_online(cpu) || !cpu_present(cpu)) {
ret = -EINVAL;
goto out;
}
diff --git a/kernel/fork.c b/kernel/fork.c
index 0c0f1ffc8932..a42ffd46532f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -61,7 +61,7 @@ int nr_processes(void)
int cpu;
int total = 0;
- for_each_cpu(cpu)
+ for_each_online_cpu(cpu)
total += per_cpu(process_counts, cpu);
return total;
diff --git a/kernel/sched.c b/kernel/sched.c
index af614e52e1b9..fa73c9675abc 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1079,7 +1079,7 @@ unsigned long nr_uninterruptible(void)
{
unsigned long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += cpu_rq(i)->nr_uninterruptible;
return sum;
@@ -1089,7 +1089,7 @@ unsigned long long nr_context_switches(void)
{
unsigned long long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += cpu_rq(i)->nr_switches;
return sum;
@@ -1099,7 +1099,7 @@ unsigned long nr_iowait(void)
{
unsigned long i, sum = 0;
- for_each_cpu(i)
+ for_each_online_cpu(i)
sum += atomic_read(&cpu_rq(i)->nr_iowait);
return sum;
diff --git a/kernel/timer.c b/kernel/timer.c
index 08cec6ae76e3..5bc2d78ba903 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -332,7 +332,7 @@ int del_timer_sync(struct timer_list *timer)
del_again:
ret += del_timer(timer);
- for_each_cpu(i) {
+ for_each_online_cpu(i) {
base = &per_cpu(tvec_bases, i);
if (base->running_timer == timer) {
while (base->running_timer == timer) {