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
70 70
71static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl)71static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl)
72{72{
73 WARN_ON(idx > num_present_cpus() || idx == IDX_INVALID);73 WARN_ON(!cpu_present(idx) || idx == IDX_INVALID);
74 74
75 if (dl_time_before(new_dl, cp->elements[idx].dl)) {75 if (dl_time_before(new_dl, cp->elements[idx].dl)) {
76 cp->elements[idx].dl = new_dl;76 cp->elements[idx].dl = new_dl;
@@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, · 40 unmodified lines
117 }117 }
118 118
119out:119out:
120 WARN_ON(best_cpu > num_present_cpus() && best_cpu != -1);120 WARN_ON(!cpu_present(best_cpu) && best_cpu != -1);
121 121
122 return best_cpu;122 return best_cpu;
123}123}
@@ -137,7 +137,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid) · 13 unmodified lines
137 int old_idx, new_cpu;137 int old_idx, new_cpu;
138 unsigned long flags;138 unsigned long flags;
139 139
140 WARN_ON(cpu > num_present_cpus());140 WARN_ON(!cpu_present(cpu));
141 141
142 raw_spin_lock_irqsave(&cp->lock, flags);142 raw_spin_lock_irqsave(&cp->lock, flags);
143 old_idx = cp->cpu_to_idx[cpu];143 old_idx = cp->cpu_to_idx[cpu];