History

sched/deadline: Test for CPU's presence explicitly

A hot-removed CPU may have ID that is numerically larger than the number of existing CPUs in the system (e.g. we can unplug CPU 4 from a system that has CPUs 0, 1 and 4). Thus the WARN_ONs should check whether the CPU in question is currently present, not whether its ID value is less than num_present_cpus().

Boris Ostrovsky committed 12 years ago

Commit 82b95801 parent 6d35ab41 file · +3 −3Browse files

Unified · Split

kernel/sched/cpudeadline.c+3−3
@@ -70,7 +70,7 @@ static void cpudl_heapify(struct cpudl *cp, int idx) · 69 unmodified lines
7070
7171 static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl)
7272 {
73− WARN_ON(idx > num_present_cpus() || idx == IDX_INVALID);
73+ WARN_ON(!cpu_present(idx) || idx == IDX_INVALID);
7474
7575 if (dl_time_before(new_dl, cp->elements[idx].dl)) {
7676 cp->elements[idx].dl = new_dl;
@@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, · 40 unmodified lines
117117 }
118118
119119 out:
120− WARN_ON(best_cpu > num_present_cpus() && best_cpu != -1);
120+ WARN_ON(!cpu_present(best_cpu) && best_cpu != -1);
121121
122122 return best_cpu;
123123 }
@@ -137,7 +137,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid) · 13 unmodified lines
137137 int old_idx, new_cpu;
138138 unsigned long flags;
139139
140− WARN_ON(cpu > num_present_cpus());
140+ WARN_ON(!cpu_present(cpu));
141141
142142 raw_spin_lock_irqsave(&cp->lock, flags);
143143 old_idx = cp->cpu_to_idx[cpu];