From: Peter Zijlstra Date: Wed, 7 Sep 2016 08:29:05 +0000 (+0200) Subject: Revert "sched/fair: Make update_min_vruntime() more readable" X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=de58af878d9146e5decc0cdd7acabaa82881cbe4;p=linux-beck.git Revert "sched/fair: Make update_min_vruntime() more readable" There's a bug in this commit: 97a7142f157a ("sched/fair: Make update_min_vruntime() more readable") ... when !rb_leftmost && curr we fail to advance min_vruntime. So revert it. Reported-by: Byungchul Park Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a6820b3771e2..986c10c25176 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -464,17 +464,20 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq) { u64 vruntime = cfs_rq->min_vruntime; + if (cfs_rq->curr) + vruntime = cfs_rq->curr->vruntime; + if (cfs_rq->rb_leftmost) { struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost, struct sched_entity, run_node); - vruntime = se->vruntime; + if (!cfs_rq->curr) + vruntime = se->vruntime; + else + vruntime = min_vruntime(vruntime, se->vruntime); } - if (cfs_rq->curr) - vruntime = min_vruntime(vruntime, cfs_rq->curr->vruntime); - /* ensure we never gain time by being placed backwards. */ cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime); #ifndef CONFIG_64BIT