lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210805063952.GA2999065@hr-amd>
Date:   Thu, 5 Aug 2021 14:39:52 +0800
From:   Huang Rui <ray.huang@....com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
CC:     "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpufreq: enhance the sequency of governor change

On Thu, Aug 05, 2021 at 01:00:23AM +0800, Rafael J. Wysocki wrote:
> On Tue, Aug 3, 2021 at 2:13 AM Huang Rui <ray.huang@....com> wrote:
> >
> > Ping~
> 
> I prefer the existing code, sorry.

It's ok, thanks anyway for the reply.

Thanks,
Ray

> 
> > On Wed, Jul 21, 2021 at 06:16:58PM +0800, Huang, Ray wrote:
> > > Keep the "success" case of governor change in the mainline of the
> > > function not in "if" case. And using restart_old_gov flag to indicate
> > > the fallback case to old governor. This is more readable and no function
> > > change.
> > >
> > > Signed-off-by: Huang Rui <ray.huang@....com>
> > > ---
> > >  drivers/cpufreq/cpufreq.c | 23 +++++++++++++++--------
> > >  1 file changed, 15 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > > index 802abc925b2a..4f7005ddb70c 100644
> > > --- a/drivers/cpufreq/cpufreq.c
> > > +++ b/drivers/cpufreq/cpufreq.c
> > > @@ -2545,18 +2545,25 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
> > >       /* start new governor */
> > >       policy->governor = new_gov;
> > >       ret = cpufreq_init_governor(policy);
> > > -     if (!ret) {
> > > -             ret = cpufreq_start_governor(policy);
> > > -             if (!ret) {
> > > -                     pr_debug("governor change\n");
> > > -                     sched_cpufreq_governor_change(policy, old_gov);
> > > -                     return 0;
> > > -             }
> > > +     if (ret)
> > > +             goto restart_old_gov;
> > > +
> > > +     ret = cpufreq_start_governor(policy);
> > > +     if (ret) {
> > >               cpufreq_exit_governor(policy);
> > > +             goto restart_old_gov;
> > >       }
> > >
> > > +     pr_debug("governor change\n");
> > > +
> > > +     sched_cpufreq_governor_change(policy, old_gov);
> > > +
> > > +     return 0;
> > > +
> > > +restart_old_gov:
> > >       /* new governor failed, so re-start old one */
> > > -     pr_debug("starting governor %s failed\n", policy->governor->name);
> > > +     pr_debug("starting governor %s failed\n",
> > > +              policy->governor->name);
> > >       if (old_gov) {
> > >               policy->governor = old_gov;
> > >               if (cpufreq_init_governor(policy))
> > > --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ