Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1675210 > unrolled thread

Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2017-06-27 02:30 +0200
Last post2017-06-28 23:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-06-27 02:30 +0200
    Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns Viresh Kumar <viresh.kumar@linaro.org> - 2017-06-27 06:30 +0200
      Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns "Rafael J. Wysocki" <rafael@kernel.org> - 2017-06-27 18:10 +0200
        Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns Viresh Kumar <viresh.kumar@linaro.org> - 2017-06-28 06:20 +0200
          Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-06-28 23:10 +0200

#1675210 — Re: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-06-27 02:30 +0200
SubjectRe: [PATCH] cpufreq: dt: Set default policy->transition_delay_ns
Message-ID<tWMyd-15q-7@gated-at.bofh.it>
On Monday, May 22, 2017 04:57:27 PM Viresh Kumar wrote:
> On 22-05-17, 19:17, Leo Yan wrote:
> > This afternoon Amit pointed me for this patch, should fix as below?
> > Otherwise it seems directly assign the same value from unit 'ns' to
> > 'us' but without any value conversion.
> > 
> > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > index 76877a6..dcc90fc 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -538,7 +538,7 @@ static int sugov_init(struct cpufreq_policy *policy)
> >                 unsigned int lat;
> >  
> >                 tunables->rate_limit_us = LATENCY_MULTIPLIER;
> > -               lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
> > +               lat = policy->cpuinfo.transition_latency / NSEC_PER_MSEC;
> >                 if (lat)
> >                         tunables->rate_limit_us *= lat;
> >         }
> 
> I will let Rafael comment in as well. NSEC_PER_USEC is used in the
> earlier governors as well (ondemand/conservative) in exactly the same
> way as schedutil is using.

The reason why it is used by schedutil is because the other governors used it
that way.  IOW, doesn't matter. :-)

Thanks,
Rafael

[toc] | [next] | [standalone]


#1675280

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-06-27 06:30 +0200
Message-ID<tWQiu-3Iv-29@gated-at.bofh.it>
In reply to#1675210
On 27-06-17, 02:15, Rafael J. Wysocki wrote:
> On Monday, May 22, 2017 04:57:27 PM Viresh Kumar wrote:
> > On 22-05-17, 19:17, Leo Yan wrote:
> > > This afternoon Amit pointed me for this patch, should fix as below?
> > > Otherwise it seems directly assign the same value from unit 'ns' to
> > > 'us' but without any value conversion.
> > > 
> > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > > index 76877a6..dcc90fc 100644
> > > --- a/kernel/sched/cpufreq_schedutil.c
> > > +++ b/kernel/sched/cpufreq_schedutil.c
> > > @@ -538,7 +538,7 @@ static int sugov_init(struct cpufreq_policy *policy)
> > >                 unsigned int lat;
> > >  
> > >                 tunables->rate_limit_us = LATENCY_MULTIPLIER;
> > > -               lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;

I think the above line is just fine and the below one is incorrect, as
we wanted to convert transition latency to usec here (i.e. in the
units of rate_limit_us).

> > > +               lat = policy->cpuinfo.transition_latency / NSEC_PER_MSEC;
> > >                 if (lat)
> > >                         tunables->rate_limit_us *= lat;
> > >         }
> > 
> > I will let Rafael comment in as well. NSEC_PER_USEC is used in the
> > earlier governors as well (ondemand/conservative) in exactly the same
> > way as schedutil is using.
> 
> The reason why it is used by schedutil is because the other governors used it
> that way.  IOW, doesn't matter. :-)

But I feel the value of LATENCY_MULTIPLIER (1000) is way too high. It currently
says that if freq-switching takes time X, then we should wait for 999X time
before we change the freq again.

Perhaps LATENCY_MULTIPLIER should be just 10 or 20 here. For a platform with
transition_latency 500 us, rate_limit_us comes to 500 ms. Which is absurd. We
ideally want it to be around 10-20 ms here. And compared to other ARM platforms,
500 us transition_latency is very low. It normally is around 1-3 ms for ARM32
platforms.

@Rafael: Will it be fine to lower down the value of LATENCY_MULTIPLIER?

-- 
viresh

[toc] | [prev] | [next] | [standalone]


#1675951

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-06-27 18:10 +0200
Message-ID<tX1dV-2UD-51@gated-at.bofh.it>
In reply to#1675280
Hi,

On Tue, Jun 27, 2017 at 6:20 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 27-06-17, 02:15, Rafael J. Wysocki wrote:
>> On Monday, May 22, 2017 04:57:27 PM Viresh Kumar wrote:
>> > On 22-05-17, 19:17, Leo Yan wrote:
>> > > This afternoon Amit pointed me for this patch, should fix as below?
>> > > Otherwise it seems directly assign the same value from unit 'ns' to
>> > > 'us' but without any value conversion.
>> > >
>> > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
>> > > index 76877a6..dcc90fc 100644
>> > > --- a/kernel/sched/cpufreq_schedutil.c
>> > > +++ b/kernel/sched/cpufreq_schedutil.c
>> > > @@ -538,7 +538,7 @@ static int sugov_init(struct cpufreq_policy *policy)
>> > >                 unsigned int lat;
>> > >
>> > >                 tunables->rate_limit_us = LATENCY_MULTIPLIER;
>> > > -               lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
>
> I think the above line is just fine and the below one is incorrect, as
> we wanted to convert transition latency to usec here (i.e. in the
> units of rate_limit_us).
>
>> > > +               lat = policy->cpuinfo.transition_latency / NSEC_PER_MSEC;
>> > >                 if (lat)
>> > >                         tunables->rate_limit_us *= lat;
>> > >         }
>> >
>> > I will let Rafael comment in as well. NSEC_PER_USEC is used in the
>> > earlier governors as well (ondemand/conservative) in exactly the same
>> > way as schedutil is using.
>>
>> The reason why it is used by schedutil is because the other governors used it
>> that way.  IOW, doesn't matter. :-)
>
> But I feel the value of LATENCY_MULTIPLIER (1000) is way too high. It currently
> says that if freq-switching takes time X, then we should wait for 999X time
> before we change the freq again.
>
> Perhaps LATENCY_MULTIPLIER should be just 10 or 20 here. For a platform with
> transition_latency 500 us, rate_limit_us comes to 500 ms. Which is absurd. We
> ideally want it to be around 10-20 ms here. And compared to other ARM platforms,
> 500 us transition_latency is very low. It normally is around 1-3 ms for ARM32
> platforms.
>
> @Rafael: Will it be fine to lower down the value of LATENCY_MULTIPLIER?

We can do that, but then I think we need to compensate for the change
in the old governors code or there may be surprises.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1676354

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-06-28 06:20 +0200
Message-ID<tXcCl-1Yd-3@gated-at.bofh.it>
In reply to#1675951
On 27-06-17, 18:08, Rafael J. Wysocki wrote:
> On Tue, Jun 27, 2017 at 6:20 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > @Rafael: Will it be fine to lower down the value of LATENCY_MULTIPLIER?
> 
> We can do that, but then I think we need to compensate for the change
> in the old governors code or there may be surprises.

Why shouldn't we change the value of LATENCY_MULTIPLIER for old
governors as well? They use the same calculations and the sampling
rate there is also this bad (like rate_limit_us).

If we aren't going to change that for old governors, then we can
create a local version of LATENCY_MULTIPLIER for schedutil I believe.

-- 
viresh

[toc] | [prev] | [next] | [standalone]


#1677169

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-06-28 23:10 +0200
Message-ID<tXsnL-2zA-3@gated-at.bofh.it>
In reply to#1676354
On Wednesday, June 28, 2017 09:44:55 AM Viresh Kumar wrote:
> On 27-06-17, 18:08, Rafael J. Wysocki wrote:
> > On Tue, Jun 27, 2017 at 6:20 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > > @Rafael: Will it be fine to lower down the value of LATENCY_MULTIPLIER?
> > 
> > We can do that, but then I think we need to compensate for the change
> > in the old governors code or there may be surprises.
> 
> Why shouldn't we change the value of LATENCY_MULTIPLIER for old
> governors as well? They use the same calculations and the sampling
> rate there is also this bad (like rate_limit_us).

On some systems.  On other systems it isn't.

> If we aren't going to change that for old governors, then we can
> create a local version of LATENCY_MULTIPLIER for schedutil I believe.

OK, so at least for intel_pstate and acpi-cpufreq we want a 10 ms default
which is what we have currently.

If you want to rework all that, make sure you preserve that.

Thanks,
Rafael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web