From patchwork Tue Mar 13 10:35:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Scordino X-Patchwork-Id: 10278127 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8D447602C2 for ; Tue, 13 Mar 2018 10:35:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CD5B28CF5 for ; Tue, 13 Mar 2018 10:35:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F22228F37; Tue, 13 Mar 2018 10:35:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56F1A28CF5 for ; Tue, 13 Mar 2018 10:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932514AbeCMKfw (ORCPT ); Tue, 13 Mar 2018 06:35:52 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34449 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932736AbeCMKfu (ORCPT ); Tue, 13 Mar 2018 06:35:50 -0400 Received: by mail-wr0-f195.google.com with SMTP id o8so21118491wra.1 for ; Tue, 13 Mar 2018 03:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=evidence-eu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=uDHH7nAQZKTCVA8HiNbwXj5kmjT2tC18FIsLHHKzCKQ=; b=dWbZQaP1GZhyCOGGr75ue+zTfP8mnhau1a0bxM73x6Yk7SvJ3zefs60MwwLAa5g+Kj Q0WvuVU9ypbbj1kzz0EEJlaZQ1dlJZTx/Nf9QO2DlAZDa6HJDKdkrrzvalU6/Rxnqx4E 7wGlW5r1UJ7Z7WVDEov2MWn+xtpdnFi3GuCYDVO036QBDt+Nmp8tu1142dyLaPngLU8j tcNq0+P0HwMJs/O5YnqIFl116/rH0PYfEGvH9O9p+M/SUJiXzGSYqJ4Ma/AfaGCbC5E3 Wia/vMyOI6y+3bvtc5giPZ49CZ2VOsTp2hUkM7WoH6f02S8qzNIceTgH8hvl41BQ40tM gZew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uDHH7nAQZKTCVA8HiNbwXj5kmjT2tC18FIsLHHKzCKQ=; b=LtyNX6saNO4NcEluds+LHEfsaPgTf2nQ2Cery5PKll4NFT2RMkWn2TaLfM9rDAiQ3K VhWDKZ8AwtVLNHCXZ31lA6UcPWD35Gj1A2cWrHkW3DxDu/fuHN5nuEDLHm61KHEM7kPe ouZ17rub5zWjZFeTxLJWjHW1YE+CSmNOTPi9Tdjkl3lXvYAfKZIo7a/IcK/+JxNfRvwf FZVo2o5HLpd9+hKLRHzbu70DLtvaG6YeeISdE4XHTAzGwa2U9pf3e2+ocsXprpMgJpXR ZC3iEdmCPVBTO4uDQvbwnEVnb7bQt/9J3XPtSG6UNN9047RHZikrfnPxPvCRj6X+WmaX kmKQ== X-Gm-Message-State: AElRT7Gvf4hutCLhklsLadl+aDYxpPHHiguzzaM+HfeBo+DqBItN5irN CMwsL2L/NecUW6EtgGhFkOfEHA== X-Google-Smtp-Source: AG47ELtcgZyBsnZEyHxp1iKr2dyjoDFrIJAH8lRNtMKdNDOjGjrMrd9cPRPAJlv9mJjM5R8Oy6PwuA== X-Received: by 10.28.165.12 with SMTP id o12mr313405wme.120.1520937349655; Tue, 13 Mar 2018 03:35:49 -0700 (PDT) Received: from localhost.localdomain (host92-93-static.8-79-b.business.telecomitalia.it. [79.8.93.92]) by smtp.gmail.com with ESMTPSA id n12sm226337wmc.35.2018.03.13.03.35.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Mar 2018 03:35:48 -0700 (PDT) From: Claudio Scordino To: Peter Zijlstra , Ingo Molnar Cc: Claudio Scordino , "Rafael J . Wysocki" , Viresh Kumar , Patrick Bellasi , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Vincent Guittot , Todd Kjos , Joel Fernandes , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] cpufreq: schedutil: rate limits for SCHED_DEADLINE Date: Tue, 13 Mar 2018 11:35:40 +0100 Message-Id: <1520937340-2755-1-git-send-email-claudio@evidence.eu.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the SCHED_DEADLINE scheduling class increases the CPU utilization, we should not wait for the rate limit, otherwise we may miss some deadline. Tests using rt-app on Exynos5422 with up to 10 SCHED_DEADLINE tasks have shown reductions of even 10% of deadline misses with a negligible increase of energy consumption (measured through Baylibre Cape). Signed-off-by: Claudio Scordino Acked-by: Viresh Kumar Reviewed-by: Rafael J. Wysocki CC: Rafael J. Wysocki CC: Viresh Kumar CC: Patrick Bellasi CC: Dietmar Eggemann CC: Morten Rasmussen CC: Juri Lelli CC: Vincent Guittot CC: Todd Kjos CC: Joel Fernandes CC: linux-pm@vger.kernel.org CC: linux-kernel@vger.kernel.org --- Changes from v3: - Specific routine renamed as ignore_dl_rate_limit() --- Changes from v2: - Rate limit ignored also in case of "fast switch" - Specific routine added --- Changes from v1: - Logic moved from sugov_should_update_freq() to sugov_update_single()/_shared() to not duplicate data structures - Rate limit not ignored in case of "fast switch" --- kernel/sched/cpufreq_schedutil.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index feb5f89..2aeb1ca 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -257,6 +257,16 @@ static bool sugov_cpu_is_busy(struct sugov_cpu *sg_cpu) static inline bool sugov_cpu_is_busy(struct sugov_cpu *sg_cpu) { return false; } #endif /* CONFIG_NO_HZ_COMMON */ +/* + * Make sugov_should_update_freq() ignore the rate limit when DL + * has increased the utilization. + */ +static inline void ignore_dl_rate_limit(struct sugov_cpu *sg_cpu, struct sugov_policy *sg_policy) +{ + if (cpu_util_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->util_dl) + sg_policy->need_freq_update = true; +} + static void sugov_update_single(struct update_util_data *hook, u64 time, unsigned int flags) { @@ -270,6 +280,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time); sg_cpu->last_update = time; + ignore_dl_rate_limit(sg_cpu, sg_policy); + if (!sugov_should_update_freq(sg_policy, time)) return; @@ -351,6 +363,8 @@ sugov_update_shared(struct update_util_data *hook, u64 time, unsigned int flags) raw_spin_lock(&sg_policy->update_lock); + ignore_dl_rate_limit(sg_cpu, sg_policy); + sugov_get_util(sg_cpu); sg_cpu->flags = flags;