From patchwork Thu Mar 8 10:29:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Scordino X-Patchwork-Id: 10267565 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 B893E6016D for ; Thu, 8 Mar 2018 10:29:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7BA22985B for ; Thu, 8 Mar 2018 10:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AC6829860; Thu, 8 Mar 2018 10:29:25 +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 D98AD2985B for ; Thu, 8 Mar 2018 10:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755425AbeCHK3Y (ORCPT ); Thu, 8 Mar 2018 05:29:24 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39760 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755079AbeCHK3W (ORCPT ); Thu, 8 Mar 2018 05:29:22 -0500 Received: by mail-wr0-f196.google.com with SMTP id w77so5124216wrc.6 for ; Thu, 08 Mar 2018 02:29:22 -0800 (PST) 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=7BLyge5nON7g8D4+4upObl4YIehueW+JD3mjcUG68hI=; b=KOCrnh/7wZlEkqMHo1tEZAvYVwrO+CgBeuRwK5ovvvWl0qgpgKPEgPzf+kcthcqsrv PtwLIyjslTlxqnaw/eaSTCGP8DxQZ2CQSHn07jMtm1u8J7xZymfKMF2q+FCdWCtxfkV3 88DOKqhTd3vMjCTGhPkt6gEvpuEVELnhLdOCodgP8TyxsYMDLvqk2rHLI+HQ9nmETscV uu838Qm5BjuqtUUbAHVvNBlUiLem/K9+ZPBPtXJ9kIYU/dB2ej/87CqsZSCmLVKi9rEJ zhami50GQB8fg6CdMZsoLXOvPkJl+lhl5rtLHU5CTI7dUVzsfRLeIPT58BUdNhP7FCdD Fpuw== 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=7BLyge5nON7g8D4+4upObl4YIehueW+JD3mjcUG68hI=; b=BFqy+npR94WaQFmWbay/NV8q76CynM9JiwYh8sFGWG5XltpWxi3m/SBBCULO12J1gS UvrSPbrWymCqlZxF1HloynlC0/36nqG5dj1A+7KdjDZ/lkQ1iibS7MadMsTMj6fkrlpl 06zGgTeB1GrL6tFlaJwS0YAjtxdWJZkG665hPqor9yqq9QondFOpUGDHuqlLn0hSRYxD Hnhy3eJ8mmejYVejLGJp/YUwv23GW45oSF7EOZEbKFb/6++KUjcqUjD3nF7y1uoyijjZ MTe9PfG4XPBYl0sl+yCnL3BqJKu2SEYWY2+fNkdBfIJJYmNDGD5vxZCEwQ/nEk4WKczP EVzg== X-Gm-Message-State: APf1xPCCsbQLoqRnkiN6htMXIiAIoDLWgm2Q68rYoRD3Y60UH4ioD9yE z9cCnnE66ercUGLVz9HmKip3yg== X-Google-Smtp-Source: AG47ELsXFIl8IZo8u29DvEfdad9AegJPaU9hg3pgls9kKTZfoeGdI6aztb+yD9hoXlMPEjcL9F6lVg== X-Received: by 10.223.139.16 with SMTP id n16mr21465543wra.171.1520504961352; Thu, 08 Mar 2018 02:29:21 -0800 (PST) Received: from andor.evidence (host92-93-static.8-79-b.business.telecomitalia.it. [79.8.93.92]) by smtp.gmail.com with ESMTPSA id 7sm43632721wry.18.2018.03.08.02.29.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 02:29:20 -0800 (PST) From: Claudio Scordino To: Peter Zijlstra , "Rafael J . Wysocki" Cc: Claudio Scordino , Ingo Molnar , Patrick Bellasi , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Viresh Kumar , Vincent Guittot , Todd Kjos , Joel Fernandes , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] cpufreq: schedutil: rate limits for SCHED_DEADLINE Date: Thu, 8 Mar 2018 11:29:10 +0100 Message-Id: <1520504950-8544-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 CC: Ingo Molnar CC: Patrick Bellasi CC: Dietmar Eggemann CC: Morten Rasmussen CC: Juri Lelli CC: Viresh Kumar CC: Vincent Guittot CC: Todd Kjos CC: Joel Fernandes CC: linux-pm@vger.kernel.org CC: linux-kernel@vger.kernel.org Acked-by: Viresh Kumar Reviewed-by: Rafael J. Wysocki --- 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7936f54..13f9cce 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -260,6 +260,17 @@ 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 set_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) { @@ -273,6 +284,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; + set_dl_rate_limit(sg_cpu, sg_policy); + if (!sugov_should_update_freq(sg_policy, time)) return; @@ -354,6 +367,8 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, raw_spin_lock(&sg_policy->update_lock); + set_dl_rate_limit(sg_cpu, sg_policy); + sugov_get_util(sg_cpu); sg_cpu->flags = flags;