From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753993AbcAOGs4 (ORCPT ); Fri, 15 Jan 2016 01:48:56 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37315 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbcAOGsy (ORCPT ); Fri, 15 Jan 2016 01:48:54 -0500 Date: Fri, 15 Jan 2016 07:48:41 +0100 From: Luca Abeni To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Juri Lelli Subject: Re: [RFC 4/8] Improve the tracking of active utilisation Message-ID: <20160115074841.0b863bee@luca-1225C> In-Reply-To: <20160114171619.GZ6357@twins.programming.kicks-ass.net> References: <1452785094-3086-1-git-send-email-luca.abeni@unitn.it> <1452785094-3086-5-git-send-email-luca.abeni@unitn.it> <20160114171619.GZ6357@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; 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 Hi Peter, On Thu, 14 Jan 2016 18:16:19 +0100 Peter Zijlstra wrote: [...] > > + /* If the "inactive timer" is still active, stop it adn > > leave > > + * the active utilisation unchanged. > > + * If it is running, increase the active utilisation > > + */ > > + if (hrtimer_active(&dl_se->inactive_timer)) { > > + hrtimer_try_to_cancel(&dl_se->inactive_timer); > > what if cancel fails? Eh, this is a tricky point :) In this case, the "if (p->state == TASK_RUNNING) {" in inactive_task_timer() should detect what happened, and avoid decreasing the active utilization. So, we should be safe... At least, this was my plan, maybe I missed something. > > @@ -1248,8 +1370,6 @@ static void task_fork_dl(struct task_struct > > *p) static void task_dead_dl(struct task_struct *p) > > { > > struct dl_bw *dl_b = dl_bw_of(task_cpu(p)); > > - struct dl_rq *dl_rq = dl_rq_of_se(&p->dl); > > - struct rq *rq = rq_of_dl_rq(dl_rq); > > > > /* > > * Since we are TASK_DEAD we won't slip out of the domain! > > @@ -1258,10 +1378,6 @@ static void task_dead_dl(struct task_struct > > *p) /* XXX we should retain the bw until 0-lag */ > > dl_b->total_bw -= p->dl.dl_bw; > > raw_spin_unlock_irq(&dl_b->lock); > > - > > - if (task_on_rq_queued(p)) { > > - clear_running_bw(&p->dl, &rq->dl); > > - } > > what happens if the timer is still active here? then we get the timer > storage freed while enqueued? I think here (and in the successive comment) we are safe because of the get_task_struct() you mention in another email, right? Or am I missing something else? Thanks, Luca