From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751267AbdE3Lbh (ORCPT ); Tue, 30 May 2017 07:31:37 -0400 Received: from mail-qt0-f174.google.com ([209.85.216.174]:36272 "EHLO mail-qt0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbdE3Lbf (ORCPT ); Tue, 30 May 2017 07:31:35 -0400 Subject: Re: [PATCH V2 2/2] sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Xunlei Pang , Ingo Molnar , Juri Lelli , Steven Rostedt , Luca Abeni , Tommaso Cucinotta , Romulo Silva de Oliveira References: <5c800ab3a74a168a84ee5f3f84d12a02e11383be.1495803804.git.bristot@redhat.com> <20170530112932.yjw2dobbvhpyd2mp@hirez.programming.kicks-ass.net> From: Daniel Bristot de Oliveira Message-ID: <9bf7e294-5e84-c436-9fa1-d83316c06310@redhat.com> Date: Tue, 30 May 2017 13:31:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170530112932.yjw2dobbvhpyd2mp@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2017 01:29 PM, Peter Zijlstra wrote: > On Mon, May 29, 2017 at 04:24:03PM +0200, Daniel Bristot de Oliveira wrote: >> +/* >> + * Regarding the deadline, a task with implicit deadline has a relative >> + * deadline == relative period. A task with constrained deadline has a >> + * relative deadline <= relative period. >> + * >> + * Linux supports constrained deadline tasks. However, there are some >> + * restrictions applied only for tasks with constrained deadline which are >> + * not implicit deadline tasks. See update_dl_entity() to know more about >> + * such restrictions. >> + * >> + * The dl_is_constrained() returns true if the task has a constrained but >> + * not implicit deadline. >> + */ >> +static inline bool dl_is_constrained(struct sched_dl_entity *dl_se) >> +{ >> + return dl_se->dl_deadline < dl_se->dl_period; >> +} > > OK, given that: > > implicit - deadline == period > constrained - deadline <= period > > and thus constrained can still be implicit, our function > dl_is_constrained() is wrong. > > I've replaced the above with dl_is_implicit(). > > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -740,19 +740,17 @@ update_dl_revised_wakeup(struct sched_dl > /* > * Regarding the deadline, a task with implicit deadline has a relative > * deadline == relative period. A task with constrained deadline has a > - * relative deadline < relative period. > + * relative deadline <= relative period. > * > - * We supports constrained deadline tasks. However, there are some > - * restrictions applied only for tasks with constrained deadline which are > - * not implicit deadline tasks. See update_dl_entity() to know more about > - * such restrictions. > + * We support constrained deadline tasks. However, there are some restrictions > + * applied only for tasks which do not have an implicit deadline. See > + * update_dl_entity() to know more about such restrictions. > * > - * The dl_is_constrained() returns true if the task has a constrained > - * (not implicit) deadline. > + * The dl_is_implicit() returns true if the task has an implicit deadline. > */ > -static inline bool dl_is_constrained(struct sched_dl_entity *dl_se) > +static inline bool dl_is_implicit(struct sched_dl_entity *dl_se) > { > - return dl_se->dl_deadline < dl_se->dl_period; > + return dl_se->dl_deadline == dl_se->dl_period; > } > > /* > @@ -794,7 +792,7 @@ static void update_dl_entity(struct sche > if (dl_time_before(dl_se->deadline, rq_clock(rq)) || > dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) { > > - if (unlikely(dl_is_constrained(dl_se) && > + if (unlikely(!dl_is_implicit(dl_se) && > !dl_time_before(dl_se->deadline, rq_clock(rq)) && > !dl_se->dl_boosted)){ > update_dl_revised_wakeup(dl_se, rq); > @@ -1386,7 +1384,7 @@ static void enqueue_task_dl(struct rq *r > * If that is the case, the task will be throttled and > * the replenishment timer will be set to the next period. > */ > - if (!p->dl.dl_throttled && dl_is_constrained(&p->dl)) > + if (!p->dl.dl_throttled && !dl_is_implicit(&p->dl)) > dl_check_constrained_dl(&p->dl); > > if (p->on_rq == TASK_ON_RQ_MIGRATING || flags & ENQUEUE_RESTORE) { > Acked-by: Daniel Bristot de Oliveira -- Daniel