From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751615AbdBMEaF (ORCPT ); Sun, 12 Feb 2017 23:30:05 -0500 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:39286 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbdBMEaD (ORCPT ); Sun, 12 Feb 2017 23:30:03 -0500 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Mon, 13 Feb 2017 13:29:41 +0900 From: Byungchul Park To: Juri Lelli Cc: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, tkhai@yandex.ru Subject: Re: [PATCH] sched/deadline: Remove redundant code replenishing runtime Message-ID: <20170213042941.GG16086@X58A-UD3R> References: <1486717888-30580-1-git-send-email-byungchul.park@lge.com> <20170210133933.GA6123@e106622-lin> <20170213023009.GF16086@X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170213023009.GF16086@X58A-UD3R> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 13, 2017 at 11:30:09AM +0900, Byungchul Park wrote: > On Fri, Feb 10, 2017 at 01:39:33PM +0000, Juri Lelli wrote: > > Hi, > > > > On 10/02/17 18:11, Byungchul Park wrote: > > > For a task passing its deadline while !rq, it will be replenished > > > in the following path because dl_se->deadline < rq_lock. > > > > > > enqueue_dl_entity(ENQUEUE_WAKEUP) > > > update_dl_entity > > > > > > Therefore, code replenishing it in the timer callback in the case is > > > unnecessary. This is not for enhancing performance but just for removing > > > a redundant code. > > > > > > Signed-off-by: Byungchul Park > > > --- > > > kernel/sched/deadline.c | 4 +--- > > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > > > index 27737f3..9c77696 100644 > > > --- a/kernel/sched/deadline.c > > > +++ b/kernel/sched/deadline.c > > > @@ -624,10 +624,8 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) > > > * We can be both throttled and !queued. Replenish the counter > > > * but do not enqueue -- wait for our wakeup to do that. > > > */ > > > - if (!task_on_rq_queued(p)) { > > > - replenish_dl_entity(dl_se, dl_se); > > > > I think we actually want to replenish and set the next deadline at this > > point of time, not the one that we get when the task will eventually wake up. > > Hello juri, > > But I wonder if it's meaningful to set a next deadline for a 'sleeping > task', which, rather, could be worse because its bandwidth might be > distorted at the time it's woken up. > > IMHO, it's neat to set its deadline and runtime when being woken up, in > the case already passed its deadline. Am I wrong? And I found that dl_entity_overflow() returns true and replenishes the task unconditionally in update_dl_entity() again when the task is woken up, because 'runtime / (deadline - t) > dl_runtime / dl_period' is true. In other words, replenishing the sleeping task in timer callback is totally unnecessary and redundant work. > > Thank you, > Byungchul