From patchwork Wed Feb 28 11:06: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: 10247241 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 13BC260365 for ; Wed, 28 Feb 2018 11:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1499928C33 for ; Wed, 28 Feb 2018 11:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08F7228CB8; Wed, 28 Feb 2018 11:06:29 +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 2A90128C33 for ; Wed, 28 Feb 2018 11:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752293AbeB1LG1 (ORCPT ); Wed, 28 Feb 2018 06:06:27 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:32810 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbeB1LG0 (ORCPT ); Wed, 28 Feb 2018 06:06:26 -0500 Received: by mail-wr0-f195.google.com with SMTP id v18so1306725wrv.0 for ; Wed, 28 Feb 2018 03:06:25 -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=nLd9l+n7eyuAS4p4UTuIVIciE0RsQ3K5UC7Xqrf39gQ=; b=RuaiKj5A3htg33QuUMZH3aC1s3vI7qsokwb5M1R7NsZPyQ6izyxnDqvkIRQmpAmDsa pVmGnyE3R5JFlZU614VhKD3HuBWj05OI2HRY5UmKw26GkWSQ1MPwmvCiumGTWyIckduC 0lKJUPxuzimKuw/hW6U9wZgZbPTt7efmRgOEX4PBzhghR5aUykTMEskjb5VCO4AkpcJ1 1EdIW08wvLDZPl1aqj8qrYEgM1H1EiUPSsWOdQxyFw0mNP19a1Bxw2EaI5thyQhF2wAb HHu9AK1sVelUstyHWZ40inQs/vQaE1cYcmLP3KdyH0sVIh123SMrbG7o+HIP8tG8irgo e8HQ== 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=nLd9l+n7eyuAS4p4UTuIVIciE0RsQ3K5UC7Xqrf39gQ=; b=PjgRWPqD0n6rTOMOga0hWKMoYb5YJxytOyZRtJXrEqHAt79NhAUtwdzB2NykO1u+Eo uL8HVhQlSUZ+rQ/sOM9NIOKZWzFgVs4HBIawWBvQaPaMixqqSDu5lfN2YeNp/8vfvr5f 1D26ojvx3K7gVPeTqyqrsCUCN2yizZQwiEKMW2q+NsNLtBSxmjF4REX0fOnE3Usce6lG YdQAG9geFTTuARKa/W9C4a2FwiVihzjqHEqdPF7vt4ZZw3VY1DFvuwIjsuE/PRYqxhT+ 0BwvwShRb/3nWBrE73prer7eUbO19zyOUb/Ady8Yw4hGCpb8H3O0i1m5fEf4B3b56k87 iI8w== X-Gm-Message-State: APf1xPC7gi+CK8qsBDhP5vNRpUNW10rGu90YZBUc2t7W1oMIaKgC0CKv z32Q2Jcw/54i8ezPKb2qwXxCBQ== X-Google-Smtp-Source: AH8x226z/olPWf+J/gQkUfzN1xNBWgN1AMpz3v4fp5nih2TaZfuEwEC4BkXshCPjeRW96bYPrXxX8w== X-Received: by 10.223.172.76 with SMTP id v70mr17068780wrc.8.1519815984736; Wed, 28 Feb 2018 03:06:24 -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 m191sm1301097wma.42.2018.02.28.03.06.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 03:06:24 -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 v2] cpufreq: schedutil: rate limits for SCHED_DEADLINE Date: Wed, 28 Feb 2018 12:06:10 +0100 Message-Id: <1519815970-5686-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 --- 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7936f54..ca6ce72 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -273,6 +273,14 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time); sg_cpu->last_update = time; + /* + * Make sugov_should_update_freq() ignore the rate limit when DL + * has increased the utilization. + */ + if ((cpu_util_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->util_dl) && + !(sg_policy->policy->fast_switch_enabled)) + sg_policy->need_freq_update = true; + if (!sugov_should_update_freq(sg_policy, time)) return; @@ -354,6 +362,14 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, raw_spin_lock(&sg_policy->update_lock); + /* + * Make sugov_should_update_freq() ignore the rate limit when DL + * has increased the utilization. + */ + if ((cpu_util_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->util_dl) && + !(sg_policy->policy->fast_switch_enabled)) + sg_policy->need_freq_update = true; + sugov_get_util(sg_cpu); sg_cpu->flags = flags;