Re: [PATCH] sched: cpufreq_schedutil: maintain raw cache when next_f is not changed

From: Wei Wang
Date: Fri Oct 16 2020 - 13:49:06 EST


On Fri, Oct 16, 2020 at 10:36 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> On Fri, Oct 16, 2020 at 7:18 PM Wei Wang <wvw@xxxxxxxxxx> wrote:
> >
> > On Fri, Oct 16, 2020 at 10:01 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> > >
> > > On Fri, Oct 16, 2020 at 6:36 PM Wei Wang <wvw@xxxxxxxxxx> wrote:
> > > >
> > > > Currently, raw cache will be reset when next_f is changed after
> > > > get_next_freq for correctness. However, it may introduce more
> > > > cycles. This patch changes it to maintain the cached value instead of
> > > > dropping it.
> > >
> > > IMV you need to be more specific about why this helps.
> > >
> >
> > I think the idea of cached_raw_freq is to reduce the chance of calling
> > cpufreq drivers (in some arch those may be costly) but sometimes the
> > cache will be wiped for correctness. The purpose of this patch is to
> > still keep the cached value instead of wiping them.
>
> Well, I see what the problem is and how the patch is attempting to
> address it (which is not the best way to do that because of the extra
> struct member that doesn't need to be added if I'm not mistaken), but
> IMO the changelog is way too vague from the problem statement
> perspective.

Just want to bring this up in the mainline kernel. I think we can
change the patch to use a variable insides sugov_update_single. This
is adapted from Android common kernel where it has some off tree
functions making a single variable not possible but also making the
issue more obvious.