From patchwork Thu Dec 16 22:53:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 12682945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 093B8C433EF for ; Thu, 16 Dec 2021 22:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236629AbhLPWxr (ORCPT ); Thu, 16 Dec 2021 17:53:47 -0500 Received: from foss.arm.com ([217.140.110.172]:49506 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236651AbhLPWxq (ORCPT ); Thu, 16 Dec 2021 17:53:46 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 704851515; Thu, 16 Dec 2021 14:53:46 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (unknown [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04DFB3F73B; Thu, 16 Dec 2021 14:53:44 -0800 (PST) From: Qais Yousef To: "Rafael J. Wysocki" , Viresh Kumar , "Peter Zijlstra (Intel)" , Ingo Molnar Cc: Dietmar Eggemann , Vincent Guittot , Beata Michalska , Ionela Voinescu , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Qais Yousef Subject: [PATCH 2/2] sched/uclamp: Fix iowait boost escaping uclamp restriction Date: Thu, 16 Dec 2021 22:53:20 +0000 Message-Id: <20211216225320.2957053-3-qais.yousef@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216225320.2957053-1-qais.yousef@arm.com> References: <20211216225320.2957053-1-qais.yousef@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org iowait_boost signal is applied independently of util and doesn't take into account uclamp settings of the rq. An io heavy task that is capped by uclamp_max could still request higher frequency because sugov_iowait_apply() doesn't clamp the boost via uclamp_rq_util_with() like effective_cpu_util() does. Make sure that iowait_boost honours uclamp requests by calling uclamp_rq_util_with() when applying the boost. Fixes: 982d9cdc22c9 ("sched/cpufreq, sched/uclamp: Add clamps for FAIR and RT tasks") Signed-off-by: Qais Yousef Acked-by: Rafael J. Wysocki --- kernel/sched/cpufreq_schedutil.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 48327970552a..93dcea233c65 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -289,6 +289,7 @@ static void sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time) * into the same scale so we can compare. */ boost = (sg_cpu->iowait_boost * sg_cpu->max) >> SCHED_CAPACITY_SHIFT; + boost = uclamp_rq_util_with(cpu_rq(sg_cpu->cpu), boost, NULL); if (sg_cpu->util < boost) sg_cpu->util = boost; }