From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753915AbcIFFIJ (ORCPT ); Tue, 6 Sep 2016 01:08:09 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:34315 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbcIFFII (ORCPT ); Tue, 6 Sep 2016 01:08:08 -0400 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: peterz@infradead.org, mingo@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] sched/fair: Fix update_min_vruntime() to get proper min_vruntime Date: Tue, 6 Sep 2016 14:05:17 +0900 Message-Id: <1473138317-8789-1-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am sorry for making you confused. The patch I posted one year ago, Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable', has a bug, which you picked up. Please add this patch to fix it, or combine these two patches into one, or revert commit 97a7142. Whatever you want. Sorry. Thank you, Byungchul -----8<----- >>From 295895be8befbab040d6054bb8186c03daabcedd Mon Sep 17 00:00:00 2001 From: Byungchul Park Date: Tue, 6 Sep 2016 12:22:26 +0900 Subject: [PATCH] sched/fair: Fix update_min_vruntime() to get proper min_vruntime Commit 97a7142 'sched/fair: Make update_min_vruntime() more readable' introduces a bug that cfs_rq gets a wrong min_vruntime if !cfs_rq->rb_leftmost && cfs_rq->curr. This fixes it and makes it more readable and simple. Signed-off-by: Byungchul Park --- kernel/sched/fair.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a6820b3..0a5f666b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -462,21 +462,20 @@ static inline int entity_before(struct sched_entity *a, static void update_min_vruntime(struct cfs_rq *cfs_rq) { - u64 vruntime = cfs_rq->min_vruntime; - - if (cfs_rq->rb_leftmost) { - struct sched_entity *se = rb_entry(cfs_rq->rb_leftmost, - struct sched_entity, - run_node); + u64 vruntime = U64_MAX; - vruntime = se->vruntime; - } + if (cfs_rq->rb_leftmost) + vruntime = rb_entry(cfs_rq->rb_leftmost, + struct sched_entity, + run_node)->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); + if (vruntime != U64_MAX) + cfs_rq->min_vruntime = max_vruntime(cfs_rq->min_vruntime, vruntime); + #ifndef CONFIG_64BIT smp_wmb(); cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime; -- 1.9.1