From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751210AbdBONdL (ORCPT ); Wed, 15 Feb 2017 08:33:11 -0500 Received: from mail-qt0-f178.google.com ([209.85.216.178]:36166 "EHLO mail-qt0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781AbdBONdJ (ORCPT ); Wed, 15 Feb 2017 08:33:09 -0500 Subject: Re: [PATCH 3/2] sched/deadline: Use deadline instead of period when calculating overflow To: Juri Lelli , Luca Abeni References: <20170214142848.4e62a91f@gandalf.local.home> <20170214234926.6b415428@sweethome> <20170214191417.4dd96145@gandalf.local.home> <20170215084003.4d123e5b@luca> <20170215102919.GA1368@e106622-lin> <20170215133136.664c1bfe@luca> <20170215125925.GD1368@e106622-lin> Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tommaso Cucinotta , Mike Galbraith , Romulo Silva de Oliveira From: Daniel Bristot de Oliveira Message-ID: <0b3af651-ad0d-e74b-ea02-f8706ad13bbb@redhat.com> Date: Wed, 15 Feb 2017 14:33:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170215125925.GD1368@e106622-lin> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/15/2017 01:59 PM, Juri Lelli wrote: > Actually, another thing that we noticed, talking on IRC with Peter, is > that we seem to be replenishing differently on different occasions: When a task is awakened (not by the replenishment timer), it is not possible to know if the absolute deadline var stores the absolute deadline of activation which took place in the instant (current time) - dl_period. Therefore, assuming the next deadline is one dl_deadline away from now is correct. IOW: that is a sporadic activation - the task is activated after at least minimum inter-arrival time between activation/replenishment: > - on wakeup (if overflowing) we do > > dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline; > dl_se->runtime = pi_se->dl_runtime; In the replenishment timer, it is known that the absolute deadline instant of the previous activation is in the deadline var. So putting the absolute deadline one dl_period away is correct [1]. Another point is that this case avoids creating time drift due to latencies. For instance, in the case of a 1 ms delay of the timer (interrupts disabled?), the wakeup replenishment would push the absolute a relative deadline + 1 ms away from the previous deadline. IOW: the replenishment timer makes the periodic case - a fixed time offset from the previous activation/replenishment. > - when the replenishment timer fires (un-thottle and with runtime < 0) > > dl_se->deadline += pi_se->dl_period; > dl_se->runtime += pi_se->dl_runtime; So I think it is correct. Am I missing something? [1] For the sake of completeness: - dl_se->deadline = Absolute deadline - dl_se->dl_deadline = Relative deadline the next absolute deadline is at: dl_se->deadline = dl_next_period(dl_se) + dl_se->dl_deadline; as dl_next_period(dl_se) is: dl_se->deadline - dl_se->dl_deadline + dl_se->dl_period; the next deadline is at: dl_se->deadline = dl_se->deadline - dl_se->dl_deadline + dl_se->dl_period + dl_se->dl_deadline Which can be simplified to: dl_se->deadline = dl_se->deadline += pi_se->dl_period; because we have (- dl_se->dl_deadline) + dl_se->dl_deadline. -- Daniel