Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758564AbcDERAj (ORCPT ); Tue, 5 Apr 2016 13:00:39 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37735 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116AbcDERAi (ORCPT ); Tue, 5 Apr 2016 13:00:38 -0400 Date: Tue, 5 Apr 2016 19:00:29 +0200 From: luca abeni To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Juri Lelli Subject: Re: [RFC v2 3/7] Improve the tracking of active utilisation Message-ID: <20160405190029.45881537@utopia> In-Reply-To: <20160405124218.GW3430@twins.programming.kicks-ass.net> References: <1459523553-29089-1-git-send-email-luca.abeni@unitn.it> <1459523553-29089-4-git-send-email-luca.abeni@unitn.it> <20160405124218.GW3430@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1258 Lines: 56 Hi Peter, On Tue, 5 Apr 2016 14:42:18 +0200 Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 05:12:29PM +0200, Luca Abeni wrote: > > +static void task_go_inactive(struct task_struct *p) > > +{ > > + struct sched_dl_entity *dl_se = &p->dl; > > + struct hrtimer *timer = &dl_se->inactive_timer; > > + struct dl_rq *dl_rq = dl_rq_of_se(dl_se); > > + struct rq *rq = rq_of_dl_rq(dl_rq); > > + ktime_t now, act; > > + s64 delta; > > + u64 zerolag_time; > > s64 zerolag_time; Ok. [...] > Would something like: > > zerolag_time -= rq_clock(rq); > > > + > > + /* > > + * If the "0-lag time" already passed, decrease the active > > + * utilization now, instead of starting a timer > > + */ > > + if (ktime_us_delta(act, now) < 0) { > > if (zerolag_time < 0) > > > + sub_running_bw(dl_se, dl_rq); > > + if (!dl_task(p)) > > + __dl_clear_params(p); > > + > > + return; > > + } > > + > > + get_task_struct(p); > > + hrtimer_start(timer, act, HRTIMER_MODE_ABS); > > hrtimer_start(timer, ns_to_ktime(zerolag), HRTIMER_MODE_REL); > > > +} > > Not be simpler ? I think I blindly copied this code from the deadline timer, but yes, you are right, I am doing a lot of useless conversions here. I'll fix this. Thanks, Luca