Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3058181rwd; Mon, 22 May 2023 08:07:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KXGcp5pJC109gUfmh2bOCnJrFX/rL8ZV0zeFVYcN7Q+lVEykaRB5O0iMV4nQWHLOXUl3h X-Received: by 2002:a17:90a:69e5:b0:255:83ee:1ede with SMTP id s92-20020a17090a69e500b0025583ee1edemr1453795pjj.6.1684768034363; Mon, 22 May 2023 08:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684768034; cv=none; d=google.com; s=arc-20160816; b=a/GATUh4gvZrGfak48oQMOOT0Cmil/ZlIjBFU/0tXi9p4Td57FrMOHk+Aahm026f2k hNUKYXeV5OcDhOCSrOV7PqReX5yAvwVf0bajovGrFimPimDE5iSA1FUjgnF845gocL3x 5Km/9kcbEPeRi0YAqnFvO3fBArae29kEYNqs/Qot+J7y4wnQTNWUKYAuETijfZtwyvXD NwpNnz7oFBtad96z+uhr1PQ7bylF+XAmnm98IV3FqETaQW+wiryPQ09TjPWfJ/X/iRf7 kOkK6RIeLXy/8RwQkxfWw8XqLxJQuI/hdXXi4GY4eYcinnQwaJwkPaj/xMhAWafS1sv6 tNOA== 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=il7RHSJybm9smwO4Rv8yFmgW5nn43INiW4EtMbE9p8b6/zkJas0TNPvhPI6Wz6xdHw NyD8tq5vJCHmX96hfNqHkg38Mt79JDag+ozi89ksbwFkTA3Wn/NPqGXWSZrFvsPpDt0M zw9N6iko3XChWt07XbSW6rhib3haR5724BLRGJmWMFdSiow+qDjnqAkJ+4ooQ3fkY+7q jyHc2Gu1hvPTkukUE5y75n4v0Xgd1yF8MCwjIcojGdnyde2v0VnJU8Fnucp3smneIuKt X1w0sml6Ys/4i+roJM6lBBlT9PrdoJEyKWKyEsOM5Wlq6k+PCqm2Rag79TB5xYn4h+TH fJnw== 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 u1-20020a17090abb0100b0025366f18b08si3243500pjr.164.2023.05.22.08.06.46; Mon, 22 May 2023 08:07:14 -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 S234015AbjEVO51 (ORCPT + 99 others); Mon, 22 May 2023 10:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234091AbjEVO5X (ORCPT ); Mon, 22 May 2023 10:57:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA8A8110; Mon, 22 May 2023 07:57: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 50476139F; Mon, 22 May 2023 07:58:02 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.22.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1D1213F6C4; Mon, 22 May 2023 07:57:13 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, rafael@kernel.org, linux-pm@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: [RESEND][PATCH v2 2/3] cpufreq: schedutil: Refactor sugov_update_shared() internals Date: Mon, 22 May 2023 15:57:01 +0100 Message-Id: <20230522145702.2419654-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230522145702.2419654-1-lukasz.luba@arm.com> References: <20230522145702.2419654-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