linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	rafael@kernel.org, linux-pm@vger.kernel.org, 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,
	qyousef@google.com, qyousef@layalina.io
Subject: Re: [RESEND][PATCH v2 2/3] cpufreq: schedutil: Refactor sugov_update_shared() internals
Date: Tue, 20 Jun 2023 19:36:36 +0200	[thread overview]
Message-ID: <CAJZ5v0i+iY-xknvEZn8Se06XS3Cqyqo3p=fYcsLoFBQ7geKRHA@mail.gmail.com> (raw)
In-Reply-To: <20230522145702.2419654-3-lukasz.luba@arm.com>

On Mon, May 22, 2023 at 4:57 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> 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 <lukasz.luba@arm.com>
> ---
>  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);
>  }
> --

The first patch in the series needs some feedback from the scheduler
people, but I can apply this one right away if you want me to.

  reply	other threads:[~2023-06-20 17:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 14:56 [RESEND][PATCH v2 0/3] Add basic tracing for uclamp and schedutil Lukasz Luba
2023-05-22 14:57 ` [RESEND][PATCH v2 1/3] sched/tp: Add new tracepoint to track uclamp set from user-space Lukasz Luba
     [not found]   ` <20230531182629.nztie5rwhjl53v3d@airbuntu>
2023-06-21  3:25     ` Masami Hiramatsu
2023-06-30 11:49       ` Qais Yousef
2023-07-04  7:49         ` Lukasz Luba
2023-07-04 14:02           ` Qais Yousef
2023-07-06 11:14     ` Peter Zijlstra
2023-07-19 13:18       ` Lukasz Luba
2023-05-22 14:57 ` [RESEND][PATCH v2 2/3] cpufreq: schedutil: Refactor sugov_update_shared() internals Lukasz Luba
2023-06-20 17:36   ` Rafael J. Wysocki [this message]
2023-05-22 14:57 ` [RESEND][PATCH v2 3/3] schedutil: trace: Add tracing to capture filter out requests Lukasz Luba
2023-06-20 17:40   ` Rafael J. Wysocki
2023-06-20 18:08     ` Lukasz Luba
     [not found]   ` <20230531183105.r5tqpdx5axoogkzp@airbuntu>
2023-06-20 17:52     ` Lukasz Luba
2023-06-30 12:01       ` Qais Yousef
2023-06-30 13:25         ` Qais Yousef
2023-07-04  8:23           ` Lukasz Luba
2023-07-04 13:58             ` Qais Yousef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJZ5v0i+iY-xknvEZn8Se06XS3Cqyqo3p=fYcsLoFBQ7geKRHA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=delyank@fb.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mgorman@suse.de \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@google.com \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).