From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753373AbdBKHNf (ORCPT ); Sat, 11 Feb 2017 02:13:35 -0500 Received: from mail.santannapisa.it ([193.205.80.99]:27852 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbdBKHNe (ORCPT ); Sat, 11 Feb 2017 02:13:34 -0500 Date: Sat, 11 Feb 2017 08:12:37 +0100 From: luca abeni To: Daniel Bristot de Oliveira Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Tommaso Cucinotta , Steven Rostedt Subject: Re: [PATCH 1/2] sched/deadline: Replenishment timer should fire in the next period Message-ID: <20170211081237.0a9208be@sweethome> In-Reply-To: <77018c2ce2a17342b5d17cdb50209e667800b09a.1486754348.git.bristot@redhat.com> References: <77018c2ce2a17342b5d17cdb50209e667800b09a.1486754348.git.bristot@redhat.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-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 Daniel, On Fri, 10 Feb 2017 20:48:10 +0100 Daniel Bristot de Oliveira wrote: [...] > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 70ef2b1..3c94d85 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -505,10 +505,15 @@ static void update_dl_entity(struct > sched_dl_entity *dl_se, } > } > > +static inline u64 dl_next_period(struct sched_dl_entity *dl_se) > +{ > + return dl_se->deadline - dl_se->dl_deadline + > dl_se->dl_period; +} > + > /* > * If the entity depleted all its runtime, and if we want it to sleep > * while waiting for some new execution time to become available, we > - * set the bandwidth enforcement timer to the replenishment instant > + * set the bandwidth replenishment timer to the replenishment instant > * and try to activate it. > * > * Notice that it is important for the caller to know if the timer > @@ -530,7 +535,7 @@ static int start_dl_timer(struct task_struct *p) > * that it is actually coming from rq->clock and not from > * hrtimer's time base reading. > */ > - act = ns_to_ktime(dl_se->deadline); > + act = ns_to_ktime(dl_next_period(dl_se)); Looks like there is a real bug in the code, and your fix looks correct to me. I think it should be committed. Thanks, Luca > now = hrtimer_cb_get_time(timer); > delta = ktime_to_ns(now) - rq_clock(rq); > act = ktime_add_ns(act, delta);