From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751114AbcEICrO (ORCPT ); Sun, 8 May 2016 22:47:14 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:48159 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751061AbcEICrN (ORCPT ); Sun, 8 May 2016 22:47:13 -0400 From: Zhou Chengming To: , CC: , , Subject: [PATCH] sched: fix the calculation of __sched_period in sched_slice() Date: Mon, 9 May 2016 10:45:57 +0800 Message-ID: <1462761957-36259-1-git-send-email-zhouchengming1@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.572FFA2C.0022,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 42f37780508cd963726fde7b1399de92 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we get the sched_slice of a sched_entity, we use cfs_rq->nr_running to calculate the whole __sched_period. But cfs_rq->nr_running is the number of sched_entity in that cfs_rq, rq->nr_running is the number of all the tasks that are not throttled. So we should use the rq->nr_running to calculate the whole __sched_period value. Signed-off-by: Zhou Chengming --- kernel/sched/fair.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0fe30e6..59c9378 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -625,7 +625,7 @@ static u64 __sched_period(unsigned long nr_running) */ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) { - u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq); + u64 slice = __sched_period(rq_of(cfs_rq)->nr_running + !se->on_rq); for_each_sched_entity(se) { struct load_weight *load; -- 1.7.7