From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754178AbbJPOGI (ORCPT ); Fri, 16 Oct 2015 10:06:08 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:31437 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752228AbbJPOGG convert rfc822-to-8bit (ORCPT ); Fri, 16 Oct 2015 10:06:06 -0400 Subject: Re: [PATCH 1/2] sched/fair: Fix weight overly small for interactive group entity To: Yuyang Du , peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org References: <1444699103-20272-1-git-send-email-yuyang.du@intel.com> Cc: umgwanakikbuti@gmail.com From: Dietmar Eggemann Message-ID: <56210448.7030002@arm.com> Date: Fri, 16 Oct 2015 15:06:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1444699103-20272-1-git-send-email-yuyang.du@intel.com> X-OriginalArrivalTime: 16 Oct 2015 14:06:01.0133 (UTC) FILETIME=[C9AFB5D0:01D1081B] X-MC-Unique: JDSFhjyXQf2X-9ogiKzFpA-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yuhang, On 13/10/15 02:18, Yuyang Du wrote: > Commit 9d89c257dfb9c51a532d69 (sched/fair: Rewrite runnable load > and utilization average tracking) led to overly small weight for > interactive group entity. The case can be easily reproduced when > a number of CPU hogs compete for the CPUs at the same time (thanks > to Mike). This is largly because the task group's load average > tracking cross CPUs lags behind the real changes. > > We accelerate the group share distribution process by using the > load.weight of the cfs_rq. This may increase the entire group's > share, but we have to do so to protect the (fragile) interactive > tasks from especially CPU hogs. > > Reported-by: Mike Galbraith > Signed-off-by: Yuyang Du > --- > kernel/sched/fair.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 700eb54..601a253 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -2370,7 +2370,7 @@ static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq) > */ In commit 9d89c257dfb9c51a532d69 you also changed the comment on top of this from 'CPU's actual weight' to 'CPU's real-time load'. I assume here that the former stands for cfs_rq->load.weight and the latter for cfs_rq->avg.load_avg. Not sure though ... > tg_weight = atomic_long_read(&tg->load_avg); > tg_weight -= cfs_rq->tg_load_avg_contrib; > - tg_weight += cfs_rq_load_avg(cfs_rq); > + tg_weight += cfs_rq->load.weight; > > return tg_weight; > } > @@ -2380,7 +2380,7 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) > long tg_weight, load, shares; > > tg_weight = calc_tg_weight(tg, cfs_rq); > - load = cfs_rq_load_avg(cfs_rq); > + load = cfs_rq->load.weight; > > shares = (tg->shares * load); > if (tg_weight) > I get similar test results on a i7-4750HQ (1*4*2) system Test setup: 1 cpuhog (sysbench --test cpu --num-threads 1) each in his own cpu cgroup and each pinned to a cpu mlayer (threads=8) in a cpu cgroup (BigBuckBunny- DivXPlusHD.mkv) runtime: 100s system: Ubuntu 14.04.3 LTS desktop sum of the runtime of the mplayer threads: commit cd126afe838d (before pelt rewrite): 55.6s 4.3.0-rc5 : 36.5s 4.3.0-rc5 + patch 1/2 and 2/2 : 55.7s