Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4770140yba; Wed, 8 May 2019 02:26:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQjRX320cGIdB3roO5scZahEC09KXAESDa/23B13HCzVY1rX6n2hdECTraZO6dvwIGopd0 X-Received: by 2002:a63:61cf:: with SMTP id v198mr46179837pgb.29.1557307617700; Wed, 08 May 2019 02:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557307617; cv=none; d=google.com; s=arc-20160816; b=CjhRwqIOs+PrdA2vUmPeBF0V9fQp3oeS1VQAw3yw4KUBPuaPBM1MHIMAKMeHmm/D+J pi4WLRpFFrXRcP3KlhASOl+stHyncSdbuOGRF9liLFCJHZpxP+aY3HEF0fC27ZNFPLvm TkwA57Lilhu8AtpBFmvjSZ/gPEn4EzuPQ2NI+6tmpVISasbqI/rjIqAmSnRWQjGPDO6L VwCTkHnLKglUfNLKHEk2pYI8kpwW+XZ7kbRg805tYEvh9w5q8fdsfZoFOpmlZ/ZWob/W F1hqdx5GaeUj1sJCgdnNvYAiwjJmkNFDgZxVzCBCPHaD7HHhZT86eqdWO88hithCbJRo OlHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=IaKRJQGS5zJ3XGNxnhVR9nsycqOZoyS+RkehQfXmGE0=; b=sK0+mfGa8CPg+oWHP03dWy8O/WfmZqbXkDwEk4ca+TlL+Lh7GJr+/HDamsxnqbxWFm zXaT6CA111FzVilgff+l0Rj6S9SpHfpmdynS8MgHZvn/69xa/d76R++7Kvysi2AuEVve GItO1lGnxbX9B7KrO3ZgUHuufbGEcaFUrUNaqdx2AXg8Vep6tdVRRV/KGBbBg0KMJiXB qa2wgDVTvMEF0dlioQIT8f+n1e8c427AfLheSMWVoFM2/2LCdKdUlvN9Vwd8WKd4zBm3 GHh+kRB9lDfosws/yuQRtR/8raexU8MY/Z9n9wdhYdRjDeE7u2pkYWvsnz70UeueNMth zSkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si20686042pgv.583.2019.05.08.02.26.42; Wed, 08 May 2019 02:26:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbfEHJYt (ORCPT + 99 others); Wed, 8 May 2019 05:24:49 -0400 Received: from mail.santannapisa.it ([193.205.80.98]:62470 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726806AbfEHJYs (ORCPT ); Wed, 8 May 2019 05:24:48 -0400 Received: from [83.43.182.198] (account l.abeni@santannapisa.it HELO nowhere) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 138922343; Wed, 08 May 2019 11:24:45 +0200 Date: Wed, 8 May 2019 11:24:37 +0200 From: luca abeni To: Juri Lelli Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , Ingo Molnar , Peter Zijlstra , Vincent Guittot , "Paul E . McKenney" , Joel Fernandes , Quentin Perret , Luc Van Oostenryck , Morten Rasmussen , Daniel Bristot de Oliveira , Patrick Bellasi , Tommaso Cucinotta Subject: Re: [RFC PATCH 4/6] sched/dl: Improve capacity-aware wakeup Message-ID: <20190508112437.74661fa8@nowhere> In-Reply-To: <20190508090855.GG6551@localhost.localdomain> References: <20190506044836.2914-1-luca.abeni@santannapisa.it> <20190506044836.2914-5-luca.abeni@santannapisa.it> <20190508090855.GG6551@localhost.localdomain> Organization: Scuola Superiore S.Anna X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 May 2019 11:08:55 +0200 Juri Lelli wrote: > On 06/05/19 06:48, Luca Abeni wrote: > > From: luca abeni > > > > Instead of considering the "static CPU bandwidth" allocated to > > a SCHED_DEADLINE task (ratio between its maximum runtime and > > reservation period), try to use the remaining runtime and time > > to scheduling deadline. > > > > Signed-off-by: luca abeni > > --- > > kernel/sched/cpudeadline.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c > > index d21f7905b9c1..111dd9ac837b 100644 > > --- a/kernel/sched/cpudeadline.c > > +++ b/kernel/sched/cpudeadline.c > > @@ -114,8 +114,13 @@ static inline int dl_task_fit(const struct > > sched_dl_entity *dl_se, int cpu, u64 *c) > > { > > u64 cap = (arch_scale_cpu_capacity(NULL, cpu) * > > arch_scale_freq_capacity(cpu)) >> SCHED_CAPACITY_SHIFT; > > - s64 rel_deadline = dl_se->dl_deadline; > > - u64 rem_runtime = dl_se->dl_runtime; > > + s64 rel_deadline = dl_se->deadline - > > sched_clock_cpu(smp_processor_id()); > > + u64 rem_runtime = dl_se->runtime; > > + > > + if ((rel_deadline < 0) || (rel_deadline * > > dl_se->dl_runtime < dl_se->dl_deadline * rem_runtime)) { > > + rel_deadline = dl_se->dl_deadline; > > + rem_runtime = dl_se->dl_runtime; > > + } > > So, are you basically checking if current remaining bw can be consumed > safely? I check if the current runtime (rescaled based on the capacity) is smaller than the time to the current scheduling deadline (basically, if it can be consumed in time). However, if q / (d - t) > Q / P (where "q" is the current runtime, "d" is the scheduling deadline, "Q" is the maximum runtime, and "P" is the CBS period), then a new scheduling deadline will be generated (later), and the runtime will be reset to Q... So, I need to use the maximum budget and CBS period for checking if the task fits in the core. > > I'm not actually sure if looking at dynamic values is what we need to > do at this stage. By considering static values we fix admission > control (and scheduling). Aren't dynamic values more to do with > energy tradeoffs (and so to be introduced when starting to look at > the energy model)? Using the current runtime and scheduling deadline might allow to migrate a task to SMALL cores (if its remaining runtime is small enough), even if the rescaled Q is larger than P. So, in theory it might allow to reduce the load on big cores. If we decide that this is overkilling, I can just drop the patch. Luca > Another pair of hands maybe is to look at the dynamic spare bw of CPUs > (to check that we don't overload CPUs). > > Thanks, > > - Juri