Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5717005rwr; Tue, 9 May 2023 05:34:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZURMXbjK+TQ5Xv5VCwixbXpz4qRLEJfTNqTD/dtho5j28HPDA7Wgcm6VQiu5tn+vRbVQe X-Received: by 2002:a17:902:dac2:b0:1ac:4d3e:1bf5 with SMTP id q2-20020a170902dac200b001ac4d3e1bf5mr16883309plx.23.1683635665808; Tue, 09 May 2023 05:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683635665; cv=none; d=google.com; s=arc-20160816; b=B/mXjZDvLbU92F/KgPgUuUIAqXP6C1su8/uJ6GyVHbm5mWUPI3TcTs7yVfUPQsH9r8 buIYJZ1PP8GJcIQnFubPfBmgug9rvqE1wXuR+n1LpT4WJHZpPqy/sI4ih2loBrHotv8c a24/Oep5e+c9g+sHefCELZQxD+ErH9gwgirErXGLwcoIqBlrFeE6USbagsviPflkuFyt +QArF8evUCtx+ZBlJ9GVYQLBW60ZvaFv9wS3CaVAF9MAoML4is+Cul47pwttm+3kOiib CFcAjoAB3Wi0e/gCrroJPMV5wVhFVRqINagWz9wg53G/Pcwzamzsk+hlMP7ZyFavDWYX Cy6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=y1DGP/vuimcKVPQhm3d3sQqcgZ5EPMua16jJW05Er9s=; b=VXuT7mT4/NY6aCge9VFEq4hDJMygx4nWHw4HOuth052bwYuHGVt4jrhA4ijzbMeq7q NexZCBQrdOs93rBI19+gHLIHDiABO2wx/Euy0zfTqSEzTCkt1bHoooKxdU6IFHd1S9QY BiHqZjjQ56MEtQK8DpGVgqzm4vNoSYGpA1J/SiuOYXAWFJc/HfoU0OpCJwc+YVMQsUsh YBWsHAqHjpXFF2W+wreqD1DoLFGO+/pJTM7aDkBhKjQVvno/MTeL97MdON8AFx9psLDo QFt3opFEvHzdENwbnU9dGH893kT74LFftspr+FgJ6wnLuxvnK5uc9EFxB6KyTVbssYCS qP+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170902d49100b0019b090e497esi1461131plg.298.2023.05.09.05.34.10; Tue, 09 May 2023 05:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235687AbjEIMXJ (ORCPT + 99 others); Tue, 9 May 2023 08:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235709AbjEIMXD (ORCPT ); Tue, 9 May 2023 08:23:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0926B44AD; Tue, 9 May 2023 05:23:02 -0700 (PDT) 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 15881106F; Tue, 9 May 2023 05:23:46 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.22.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C9C743F67D; Tue, 9 May 2023 05:22:58 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: rostedt@goodmis.org, mhiramat@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, delyank@fb.com, lukasz.luba@arm.com, qyousef@google.com, qyousef@layalina.io Subject: [PATCH v2 2/3] cpufreq: schedutil: Refactor sugov_update_shared() internals Date: Tue, 9 May 2023 13:22:45 +0100 Message-Id: <20230509122246.1702397-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230509122246.1702397-1-lukasz.luba@arm.com> References: <20230509122246.1702397-1-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the if section block. Use the simple check to bail out and jump to the unlock at the end. That makes the code more readable and ready for some future tracing. Signed-off-by: Lukasz Luba --- kernel/sched/cpufreq_schedutil.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index e3211455b203..f462496e5c07 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -446,17 +446,19 @@ sugov_update_shared(struct update_util_data *hook, u64 time, unsigned int flags) ignore_dl_rate_limit(sg_cpu); - if (sugov_should_update_freq(sg_policy, time)) { - next_f = sugov_next_freq_shared(sg_cpu, time); + if (!sugov_should_update_freq(sg_policy, time)) + goto unlock; - if (!sugov_update_next_freq(sg_policy, time, next_f)) - goto unlock; + next_f = sugov_next_freq_shared(sg_cpu, time); + + if (!sugov_update_next_freq(sg_policy, time, next_f)) + goto unlock; + + if (sg_policy->policy->fast_switch_enabled) + cpufreq_driver_fast_switch(sg_policy->policy, next_f); + else + sugov_deferred_update(sg_policy); - if (sg_policy->policy->fast_switch_enabled) - cpufreq_driver_fast_switch(sg_policy->policy, next_f); - else - sugov_deferred_update(sg_policy); - } unlock: raw_spin_unlock(&sg_policy->update_lock); } -- 2.25.1