From patchwork Thu Feb 8 17:01:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Scordino X-Patchwork-Id: 10207465 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 65D8660247 for ; Thu, 8 Feb 2018 17:02:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5732F29346 for ; Thu, 8 Feb 2018 17:02:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AA1E29375; Thu, 8 Feb 2018 17:02:00 +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 A943A29346 for ; Thu, 8 Feb 2018 17:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751700AbeBHRB6 (ORCPT ); Thu, 8 Feb 2018 12:01:58 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44284 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbeBHRB5 (ORCPT ); Thu, 8 Feb 2018 12:01:57 -0500 Received: by mail-wr0-f194.google.com with SMTP id v31so5432144wrc.11 for ; Thu, 08 Feb 2018 09:01:56 -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=Kgpq/67Gf9uy7kpaBlL0QcckDjNX2oLeKsG3IesYzZE=; b=j+H+yQWTB0/PltyHDRK+KmRhlg6Mt/vKB/e6JytwC6+hd6ovss3Ub/A/J4PurfaSGV IfQVuUZF1Lni+xJoRx3DfZceceyR+NANHYpILJYgt1wK7C/0RnWPXlJM8WL3DxIo3ygD KW8RIWl4lmqd0gugaC1HqvP9S/dcMRzXDY4OxDqpK6oh8Ga/MKteXc+S3uxnEXeddiY5 K3RBiJ3YOVmlJJKxbBOgf6r5kS+zxJTE/MQ7RiA95TdU5Y80mOwnD+RJ56ZNMLdhRElS lWQW2JvNEV5xwtnBPXkP5QFG3eXcDEVrWLL9tN3mBNSOvrvAVGTOAO3VoscnxE68DCKm O5fQ== 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=Kgpq/67Gf9uy7kpaBlL0QcckDjNX2oLeKsG3IesYzZE=; b=tn6g8O13yzuQpWpJLBRBa98fjl6bEnPvrd6hYCsDP5BWaE+2Jsz9ZrG8MD92Kyi7Nz i9tg5lSsiK+8XN0Bg2gUZvzwwg2PF/WlMA7H3fws5u4CgrNWtilGu/BfsfCoG4a9dYJN YZPlaXPYcMl1lzGwcBVnKtr6SdNaBvjmw/svKSE5BdEjiZwn5aaXwY0H72vYv3a1GVRW TmBqCbbwc3sNFUzm/kuYHJJkfuaQOygNHylE4xsO7pL0EmRnNR3mdPWJzcJv64sUwHAU PL7BiccR2SoiWq+b8atvtkMiPp4D/2EAp7mN3uG6BmDP6ApcmzqABcfBjJWLKo2wzVeJ cRJg== X-Gm-Message-State: APf1xPCVygemJY+e9MNebtV63RGF3R+RQXMQnGpahp8Mxq781HLT9d8O k3KJpIK8PJmfohqLjLXEvS72nw== X-Google-Smtp-Source: AH8x224evjmFeRuwPtgbSRslDrvtDNzhuC1/5JVvBsTb1ZgJh2hxh+QRfjE0CmRN4P3fYBhXCCWfow== X-Received: by 10.223.199.194 with SMTP id y2mr1302826wrg.170.1518109316164; Thu, 08 Feb 2018 09:01:56 -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 g8sm430933wrb.88.2018.02.08.09.01.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Feb 2018 09:01:55 -0800 (PST) From: Claudio Scordino To: Peter Zijlstra , Ingo Molnar Cc: Claudio Scordino , "Rafael J . Wysocki" , 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] cpufreq: schedutil: rate limits for SCHED_DEADLINE Date: Thu, 8 Feb 2018 18:01:42 +0100 Message-Id: <1518109302-8239-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 have shown reductions of about 10% of deadline misses for tasks with low RT periods. The patch applies on top of the one recently proposed by Peter to drop the SCHED_CPUFREQ_* flags. Signed-off-by: Claudio Scordino CC: Rafael J . Wysocki 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 --- kernel/sched/cpufreq_schedutil.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index b0bd77d..d8dcba2 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -74,7 +74,10 @@ static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu); /************************ Governor internals ***********************/ -static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) +static bool sugov_should_update_freq(struct sugov_policy *sg_policy, + u64 time, + struct sugov_cpu *sg_cpu_old, + struct sugov_cpu *sg_cpu_new) { s64 delta_ns; @@ -111,6 +114,10 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) return true; } + /* Ignore rate limit when DL increased utilization. */ + if (sg_cpu_new->util_dl > sg_cpu_old->util_dl) + return true; + delta_ns = time - sg_policy->last_freq_update_time; return delta_ns >= sg_policy->freq_update_delay_ns; } @@ -271,6 +278,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, unsigned int flags) { struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); + struct sugov_cpu sg_cpu_old = *sg_cpu; struct sugov_policy *sg_policy = sg_cpu->sg_policy; unsigned long util, max; unsigned int next_f; @@ -279,7 +287,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; - if (!sugov_should_update_freq(sg_policy, time)) + if (!sugov_should_update_freq(sg_policy, time, &sg_cpu_old, sg_cpu)) return; busy = sugov_cpu_is_busy(sg_cpu); @@ -350,6 +358,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, unsigned int flags) { struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); + struct sugov_cpu sg_cpu_old = *sg_cpu; struct sugov_policy *sg_policy = sg_cpu->sg_policy; unsigned int next_f; @@ -359,7 +368,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; - if (sugov_should_update_freq(sg_policy, time)) { + if (sugov_should_update_freq(sg_policy, time, &sg_cpu_old, sg_cpu)) { next_f = sugov_next_freq_shared(sg_cpu, time); sugov_update_commit(sg_policy, time, next_f); }