From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751163AbdEaH5F (ORCPT ); Wed, 31 May 2017 03:57:05 -0400 Received: from foss.arm.com ([217.140.101.70]:40122 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbdEaH5E (ORCPT ); Wed, 31 May 2017 03:57:04 -0400 Date: Wed, 31 May 2017 08:57:00 +0100 From: Morten Rasmussen To: Vincent Guittot Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , "rjw@rjwysocki.net" , Juri Lelli , Dietmar Eggemann Subject: Re: [RFC PATCH 1/2] sched/rt: add utilization tracking Message-ID: <20170531075659.GB13580@e105550-lin.cambridge.arm.com> References: <1495616452-7582-1-git-send-email-vincent.guittot@linaro.org> <1495616452-7582-2-git-send-email-vincent.guittot@linaro.org> <20170530155035.GA13580@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 30, 2017 at 06:24:27PM +0200, Vincent Guittot wrote: > On 30 May 2017 at 17:50, Morten Rasmussen wrote: > > On Wed, May 24, 2017 at 11:00:51AM +0200, Vincent Guittot wrote: > >> @@ -1534,6 +1534,8 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) > >> return p; > >> } > >> > >> +extern int update_rt_rq_load_avg(u64 now, int cpu, struct rt_rq *rt_rq, int running); > >> + > >> static struct task_struct * > >> pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) > >> { > >> @@ -1579,6 +1581,10 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) > >> > >> queue_push_tasks(rq); > >> > >> + if (p) > >> + update_rt_rq_load_avg(rq_clock_task(rq), cpu_of(rq), rt_rq, > >> + rq->curr->sched_class == &rt_sched_class); > >> + > >> return p; > >> } > > > > I'm quite likely missing something, but why is this update need here? > > > > IIUC, put_prev_task() was called just a couple of lines further up which > > also does an update (below). The only difference is that this update > > depends on the current task being an RT task, which isn't always the > > case. Is it supposed to decay the RT PELT average when we pick an RT > > task and the previous task !RT? In that case, the "running" argument > > needs a ! in front. > > if prev task is not a rt task but a cfs task, the put_prev_task will > apply on cfs class and cfs pelt but not on rt one > so when the next task is a rt task, we have to update rt utilization > either to decay the rt utilization if curr task (prev task) is not rt, > or to add utilization if curr task is rt task. > we have something similar with put_prev_task_rt Yes. It was just me getting the logic wrong. rq->curr->sched_class == &rt_sched_class would of course be false if the previous task is CFS meaning "running" is false and hence we will decay the rt rq PELT signal as we correctly should.