Skip to content

Commit

Permalink
sched/deadline: Switch CPU's presence test order
Browse files Browse the repository at this point in the history
Commit 82b9580 ("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: Juri Lelli <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
jlelli authored and Ingo Molnar committed Feb 27, 2014
1 parent 3908ac1 commit eec751e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/sched/cpudeadline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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)) {
cp->elements[idx].dl = new_dl;
Expand Down Expand Up @@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
}

out:
WARN_ON(!cpu_present(best_cpu) && best_cpu != -1);
WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));

return best_cpu;
}
Expand Down

0 comments on commit eec751e

Please sign in to comment.