Commit eec751ed authored by Juri Lelli's avatar Juri Lelli Committed by Ingo Molnar

sched/deadline: Switch CPU's presence test order

Commit 82b95800 ("sched/deadline: Test for CPU's presence explicitly")
changed how we check if a CPU returned by cpudeadline machinery is
valid. But, we don't want to call cpu_present() if best_cpu is
equal to -1. So, switch the order of tests inside WARN_ON().
Signed-off-by: default avatarJuri Lelli <juri.lelli@gmail.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: boris.ostrovsky@oracle.com
Cc: konrad.wilk@oracle.com
Cc: rostedt@goodmis.org
Link: http://lkml.kernel.org/r/1393238832-9100-1-git-send-email-juri.lelli@gmail.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 3908ac13
...@@ -70,7 +70,7 @@ static void cpudl_heapify(struct cpudl *cp, int idx) ...@@ -70,7 +70,7 @@ static void cpudl_heapify(struct cpudl *cp, int idx)
static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl)
{ {
WARN_ON(!cpu_present(idx) || idx == IDX_INVALID); WARN_ON(idx == IDX_INVALID || !cpu_present(idx));
if (dl_time_before(new_dl, cp->elements[idx].dl)) { if (dl_time_before(new_dl, cp->elements[idx].dl)) {
cp->elements[idx].dl = new_dl; cp->elements[idx].dl = new_dl;
...@@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, ...@@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
} }
out: out:
WARN_ON(!cpu_present(best_cpu) && best_cpu != -1); WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
return best_cpu; return best_cpu;
} }
......
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