Bläddra i källkod

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 <byungchul.park@lge.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Peter Zijlstra 9 år sedan
förälder
incheckning
de58af878d
1 ändrade filer med 7 tillägg och 4 borttagningar
  1. 7 4
      kernel/sched/fair.c

+ 7 - 4
kernel/sched/fair.c

@@ -464,17 +464,20 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
 {
 {
 	u64 vruntime = cfs_rq->min_vruntime;
 	u64 vruntime = cfs_rq->min_vruntime;
 
 
+	if (cfs_rq->curr)
+		vruntime = cfs_rq->curr->vruntime;
+
 	if (cfs_rq->rb_leftmost) {
 	if (cfs_rq->rb_leftmost) {
 		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
 		struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost,
 						   struct sched_entity,
 						   struct sched_entity,
 						   run_node);
 						   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. */
 	/* ensure we never gain time by being placed backwards. */
 	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
 	cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime);
 #ifndef CONFIG_64BIT
 #ifndef CONFIG_64BIT