aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2011-01-05 05:41:17 +0100
committerWilly Tarreau <w@1wt.eu>2012-10-07 23:37:17 +0200
commit2c224ae6d1be39d99ea53fa9acd47bec111dbd68 (patch)
tree00a9754fcf6e30278effcf98fb1746ebdc54b29a /kernel
parent0b65cf58957e0b6ca52143430871077e24868c6c (diff)
sched: Fix signed unsigned comparison in check_preempt_tick()
commit d7d8294415f0ce4254827d4a2a5ee88b00be52a8 upstream. Signed unsigned comparison may lead to superfluous resched if leftmost is right of the current task, wasting a few cycles, and inadvertently _lengthening_ the current task's slice. Reported-by: Venkatesh Pallipadi <venki@google.com> Signed-off-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1294202477.9384.5.camel@marge.simson.net> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_fair.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index cd9a40b5d50..fd6e5f2a160 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -862,6 +862,9 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
struct sched_entity *se = __pick_next_entity(cfs_rq);
s64 delta = curr->vruntime - se->vruntime;
+ if (delta < 0)
+ return;
+
if (delta > ideal_runtime)
resched_task(rq_of(cfs_rq)->curr);
}