From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Yue Hu <zbestahu@163.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Yue Hu <zbestahu@gmail.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Benjamin Segall <bsegall@google.com>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Yue Hu <huyue2@yulong.com>
Subject: Re: [PATCH] cpufreq: schedutil: Don't consider freq reduction to busy CPU if need_freq_update is set
Date: Mon, 22 Feb 2021 15:30:34 +0100 [thread overview]
Message-ID: <CAJZ5v0jouxkj5uKrkNSBZUxXkSNjGY5NAo3zAqSaO9rJBGcqCQ@mail.gmail.com> (raw)
In-Reply-To: <20210222170420.000019a3.zbestahu@163.com>
On Mon, Feb 22, 2021 at 2:57 PM Yue Hu <zbestahu@163.com> wrote:
>
> On Mon, 22 Feb 2021 11:00:14 +0530
> Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> > On 19-02-21, 19:45, Yue Hu wrote:
> > > We will set next_f to next_freq(previous freq) if next_f is
> > > reduced for busy CPU. Then the next sugov_update_next_freq() will check
> > > if next_freq matches next_f if need_freq_update is not set.
> > > Obviously, we will do nothing for the case. And The related check to
> > > fast_switch_enabled and raw_spin_{lock,unlock} operations are
> > > unnecessary.
> >
> > Right, but we will still need sugov_update_next_freq() to have the
> > same implementation regardless and so I am not sure if we should add
>
> Yes, sugov_update_next_freq() should be keeping current logic for corner case.
>
> > this change:
> >
> > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > index 41e498b0008a..7289e1adab73 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -362,6 +362,9 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time,
> > * recently, as the reduction is likely to be premature then.
> > */
> > if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
> > + if (!sg_policy->need_freq_update)
>
> The initial purpose about code of `next_f = sg_policy->next_freq` here (for special CPU busy
> case) should be skipping the freq update.
>
> Since commit 600f5badb78c ("cpufreq: schedutil: Don't skip freq update when limits change"),
> we add the check to busy CPU for not skipping the update, we need to update the freq using
> computed one because limits change.
>
> After commit 23a881852f3e ("cpufreq: schedutil: Don't skip freq update if need_freq_update
> is set"), we removed the need_freq_update check(no issue of commit 600f5badb78c anymore?)
> and introduce to always do an update in sugov_update_next_freq() if need_freq_update is set
> even though current freq == sg_policy->next_freq because of corner case issue. But that is
> conflict with original purpose of the freq skip code (next_f = sg_policy->next_freq) of
> busy CPU.
That's because we realized that it was not always a good idea to skip
the update even if next_f == sg_policy->next_freq.
That's why CPUFREQ_NEED_UPDATE_LIMITS has been introduced and the
current flow is a result of subsequent code rearrangements.
next prev parent reply other threads:[~2021-02-22 14:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210218082514.1437-1-zbestahu@gmail.com>
2021-02-18 10:20 ` [PATCH] cpufreq: schedutil: Don't consider freq reduction to busy CPU if need_freq_update is set Viresh Kumar
2021-02-19 3:38 ` Yue Hu
2021-02-19 4:09 ` Viresh Kumar
2021-02-19 6:41 ` Yue Hu
2021-02-19 7:42 ` Viresh Kumar
2021-02-19 8:20 ` Yue Hu
2021-02-19 9:35 ` Viresh Kumar
2021-02-19 11:45 ` Yue Hu
2021-02-22 5:30 ` Viresh Kumar
2021-02-22 9:04 ` Yue Hu
2021-02-22 14:30 ` Rafael J. Wysocki [this message]
2021-02-24 2:24 ` Yue Hu
2021-02-24 12:46 ` Rafael J. Wysocki
2021-02-25 1:38 ` Yue Hu
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=CAJZ5v0jouxkj5uKrkNSBZUxXkSNjGY5NAo3zAqSaO9rJBGcqCQ@mail.gmail.com \
--to=rafael@kernel.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=huyue2@yulong.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=zbestahu@163.com \
--cc=zbestahu@gmail.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).