Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6282953rwl; Wed, 22 Mar 2023 08:39:37 -0700 (PDT) X-Google-Smtp-Source: AK7set8asUDhaCld0of8PSFYjEGxKYaoZbc20Q9lTmeKwv/YgU0kSHxOLrJYT2mJs+nNBQUl6qi2 X-Received: by 2002:aa7:cb8f:0:b0:4fa:cbd8:3f6f with SMTP id r15-20020aa7cb8f000000b004facbd83f6fmr7132544edt.6.1679499577693; Wed, 22 Mar 2023 08:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679499577; cv=none; d=google.com; s=arc-20160816; b=c3ooMvgONxpuQ905nEF8sx/TNwUazb9EOYYK6YnhXlcOmdpkSQlyrpU2AgxmELeBOY Mzrt01p2pdynhUFX5Q49cRuuKnBOpScVvzyt2nAfv5uLGqbxag3lnpwC7rcQvRvjepVZ 2+dcp6MwD1rA1+asRuvn0HOC8IUYQWdvVFRpI7AaYoVQN2sdQDqOyT/vx4aB4YeqH0sO bReQYl1CQ4AHuCS2WkogR0BapSTIunlB5iXWkY/Ulm7RTei+MZbYKgjlOMAesJQQVyLM IYToy7VUO8Pu3Y0dGGf/ZzkIh28zM/N+fCKxP+jv4UnDEnC6qw4cnzoX/8hcEIFKZaPO iFMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=fd+REC0vcyFBAtDImo5BKDP8+siqdj/oKjE92NmOqCg=; b=L2RL6v4rjf4v7fAjbMxYqQ9APnC3/o9JQCE+oaKdyDHzNDSfj89LofgJiV5zvAbILd 11EQ6MsmqQqEGD5zbG5P2B8tJK6WiJ73xQFwh9RmLpkON2Y7vVzsQtHOIFN9WNymgWwP sB5h86BpZWejxMLZ59zmebAcZdigAWaD9NLrECwylsd9tbp1/bw9r26kMEjkv8gksJwo seQOVe04phdoAqLsX4ARoBp9XoMLSXtpO9Fn8cpD6C20aUKO1kTpCab579gYRR4EDuxV z3088S770QwY0kS/SKP8IYb7nfgJR8y3CbwosO2oQIDiZyoQ4+ZIQ5nzQIKkgoMzjNk3 yNBA== 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 i25-20020aa7c719000000b005003eff3f7asi16510676edq.302.2023.03.22.08.39.14; Wed, 22 Mar 2023 08:39:37 -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 S231609AbjCVPUU (ORCPT + 99 others); Wed, 22 Mar 2023 11:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbjCVPUS (ORCPT ); Wed, 22 Mar 2023 11:20:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B68445DC8B; Wed, 22 Mar 2023 08:20:17 -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 6A60E15DB; Wed, 22 Mar 2023 08:21:01 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.18.173]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BE2843F71E; Wed, 22 Mar 2023 08:20:14 -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 Subject: [PATCH 2/3] cpufreq: schedutil: Refactor sugov_update_shared() internals Date: Wed, 22 Mar 2023 15:18:42 +0000 Message-Id: <20230322151843.14390-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230322151843.14390-1-lukasz.luba@arm.com> References: <20230322151843.14390-1-lukasz.luba@arm.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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.17.1