From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932112AbdBNRbP (ORCPT ); Tue, 14 Feb 2017 12:31:15 -0500 Received: from mail-qk0-f180.google.com ([209.85.220.180]:36206 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755006AbdBNRbH (ORCPT ); Tue, 14 Feb 2017 12:31:07 -0500 Subject: Re: [PATCH V2 2/2] sched/deadline: Throttle a constrained deadline task activated after the deadline To: Tommaso Cucinotta , linux-kernel@vger.kernel.org References: <490c988dfa230047b8747ce94abf2db6fa141a43.1487003778.git.bristot@redhat.com> <501277c7-d7b2-e1c2-4f10-eda9b6624956@santannapisa.it> Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Tommaso Cucinotta , Luca Abeni , Steven Rostedt , Mike Galbraith , Romulo Silva de Oliveira From: Daniel Bristot de Oliveira Message-ID: <22506896-8746-0b32-13eb-a2c1c2e783a9@redhat.com> Date: Tue, 14 Feb 2017 18:31:02 +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: <501277c7-d7b2-e1c2-4f10-eda9b6624956@santannapisa.it> 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/14/2017 04:54 PM, Tommaso Cucinotta wrote: > On 13/02/2017 20:05, Daniel Bristot de Oliveira wrote: >> To avoid this problem, in the activation of a constrained deadline >> task after the deadline but before the next period, throttle the >> task and set the replenishing timer to the begin of the next period, >> unless it is boosted. > > my only comment is that, by throttling on (dl < wakeuptime < period), we > force the app to sync its activation time with the kernel, and the cbs > doesn't self-sync anymore with the app own periodicity, which is what > normally happens with dl=period. With dl=period, we loose the cbs > self-sync and we force the app to sync with the kernel periodic timer > only if we use explicitly yield(), but now this becomes also implicit > just if we set dl >> attr.sched_policy = SCHED_DEADLINE; >> attr.sched_runtime = 2 * 1000 * 1000; /* 2 ms */ >> attr.sched_deadline = 2 * 1000 * 1000; /* 2 ms */ >> attr.sched_period = 2 * 1000 * 1000 * 1000; /* 2 s */ > ... >> On my box, this reproducer uses almost 50% of the CPU time, which is >> obviously wrong for a task with 2/2000 reservation. > > just a note here: in this example of runtime=deadline=2ms, shall we rely > on a utilization-based test, then we should assume the task is taking 100%. > More precise tests for EDF with deadline 1998ms/2000ms free space, instead. Yeah, it is taking 100% for runtime/deadline. But the admission is runtime/period, so it will pass. The idea of runtime=deadline is to avoid the task being throttled. If the task is throttle we would not be able to demonstrate this bug. Anyway, we can set runtime = (0.95 * deadline), it will also reproduce the problem, as long as the task is put to sleep before being throttled. Thanks! -- Daniel