Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1620739 > unrolled thread
| Started by | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| First post | 2017-04-10 23:20 +0200 |
| Last post | 2017-04-11 23:10 +0200 |
| Articles | 3 — 2 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.
Re: [RFC/RFT][PATCH 2/2] cpufreq: schedutil: Utilization aggregation "Rafael J. Wysocki" <rafael@kernel.org> - 2017-04-10 23:20 +0200
Re: [RFC/RFT][PATCH 2/2] cpufreq: schedutil: Utilization aggregation Juri Lelli <juri.lelli@arm.com> - 2017-04-11 09:10 +0200
Re: [RFC/RFT][PATCH 2/2] cpufreq: schedutil: Utilization aggregation "Rafael J. Wysocki" <rafael@kernel.org> - 2017-04-11 23:10 +0200
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2017-04-10 23:20 +0200 |
| Subject | Re: [RFC/RFT][PATCH 2/2] cpufreq: schedutil: Utilization aggregation |
| Message-ID | <tuOT8-6cJ-7@gated-at.bofh.it> |
On Mon, Apr 10, 2017 at 1:26 PM, Juri Lelli <juri.lelli@arm.com> wrote:
> Hi Rafael,
Hi,
> thanks for this set. I'll give it a try (together with your previous
> patch) in the next few days.
>
> A question below.
>
> On 10/04/17 02:11, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> Due to the limitation of the rate of frequency changes the schedutil
>> governor only estimates the CPU utilization entirely when it is about
>> to update the frequency for the corresponding cpufreq policy. As a
>> result, the intermediate utilization values are discarded by it,
>> but that is not appropriate in general (like, for example, when
>> tasks migrate from one CPU to another or exit, in which cases the
>> utilization measured by PELT may change abruptly between frequency
>> updates).
>>
>> For this reason, modify schedutil to estimate CPU utilization
>> completely whenever it is invoked for the given CPU and store the
>> maximum encountered value of it as input for subsequent new frequency
>> computations. This way the new frequency is always based on the
>> maximum utilization value seen by the governor after the previous
>> frequency update which effectively prevents intermittent utilization
>> variations from causing it to be reduced unnecessarily.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> ---
>
> [...]
>
>> -static void sugov_get_util(unsigned long *util, unsigned long *max)
>> +static void sugov_get_util(struct sugov_cpu *sg_cpu, unsigned int flags)
>> {
>> + unsigned long cfs_util, cfs_max;
>> struct rq *rq = this_rq();
>> - unsigned long cfs_max;
>>
>> - cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id());
>> + sg_cpu->flags |= flags & SCHED_CPUFREQ_RT_DL;
>> + if (sg_cpu->flags & SCHED_CPUFREQ_RT_DL)
>> + return;
>>
>
> IIUC, with this you also keep track of any RT/DL tasks that woke up
> during the last throttling period, and react accordingly as soon a
> triggering event happens after the throttling period elapses.
Right (that's the idea at least).
> Given that for RT (and still for DL as well) the next event is a
> periodic tick, couldn't happen that the required frequency transition
> for an RT task, that unfortunately woke up before the end of a throttling
> period, gets delayed of a tick interval (at least 4ms on ARM)?
No, that won't be an entire tick unless it wakes up exactly at the
update time AFAICS.
> Don't we need to treat such wake up events (RT/DL) in a special way and
> maybe set a timer to fire and process them as soon as the current
> throttling period elapses? Might be a patch on top of this I guess.
Setting a timer won't be a good idea at all, as it would need to be a
deferrable one and Thomas would not like that (I'm sure).
We could in principle add some special casing around that, like for
example pass flags to sugov_should_update_freq() and opportunistically
ignore freq_update_delay_ns if SCHED_CPUFREQ_RT_DL is set in there,
but that would lead to extra overhead on systems where frequency
updates happen in-context.
Also the case looks somewhat corner to me to be honest.
Thanks,
Rafael
[toc] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2017-04-11 09:10 +0200 |
| Message-ID | <tuY66-3Oc-9@gated-at.bofh.it> |
| In reply to | #1620739 |
On 10/04/17 23:13, Rafael J. Wysocki wrote: > On Mon, Apr 10, 2017 at 1:26 PM, Juri Lelli <juri.lelli@arm.com> wrote: [...] > > Given that for RT (and still for DL as well) the next event is a > > periodic tick, couldn't happen that the required frequency transition > > for an RT task, that unfortunately woke up before the end of a throttling > > period, gets delayed of a tick interval (at least 4ms on ARM)? > > No, that won't be an entire tick unless it wakes up exactly at the > update time AFAICS. > Right. I was trying to think about worst case, as I'm considering RT type of tasks. > > Don't we need to treat such wake up events (RT/DL) in a special way and > > maybe set a timer to fire and process them as soon as the current > > throttling period elapses? Might be a patch on top of this I guess. > > Setting a timer won't be a good idea at all, as it would need to be a > deferrable one and Thomas would not like that (I'm sure). > Why deferrable? IMHO, we should be servicing RT requestes as soon as the HW is capable of. Even a small delay of, say, a couple of ms could be causing deadline misses. > We could in principle add some special casing around that, like for > example pass flags to sugov_should_update_freq() and opportunistically > ignore freq_update_delay_ns if SCHED_CPUFREQ_RT_DL is set in there, > but that would lead to extra overhead on systems where frequency > updates happen in-context. > Also, it looks still event driven to me. If the RT task is the only thing running, nothing will trigger a potential frequency change re-evaluation before the next tick. > Also the case looks somewhat corner to me to be honest. > Sure. Only thinking about potential problems here. However, playing with my DL patches I noticed that this can be actually a problem, as for DL, for example, we trigger a frequency switch when the task wakes up, but then we don't do anything during the tick (because it doesn't seem to make sense to do anything :). So, if we missed the opportunity to increase frequency at enqueue time, the task is hopelessly done. :( Anyway, since this looks anyway something that we might want on top of your patches, I'll play with the idea when refreshing my set and see what I get. Thanks, - Juri
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2017-04-11 23:10 +0200 |
| Message-ID | <tvbd0-3RY-13@gated-at.bofh.it> |
| In reply to | #1620959 |
On Tue, Apr 11, 2017 at 9:00 AM, Juri Lelli <juri.lelli@arm.com> wrote: > On 10/04/17 23:13, Rafael J. Wysocki wrote: >> On Mon, Apr 10, 2017 at 1:26 PM, Juri Lelli <juri.lelli@arm.com> wrote: > > [...] > >> > Given that for RT (and still for DL as well) the next event is a >> > periodic tick, couldn't happen that the required frequency transition >> > for an RT task, that unfortunately woke up before the end of a throttling >> > period, gets delayed of a tick interval (at least 4ms on ARM)? >> >> No, that won't be an entire tick unless it wakes up exactly at the >> update time AFAICS. >> > > Right. I was trying to think about worst case, as I'm considering RT > type of tasks. > >> > Don't we need to treat such wake up events (RT/DL) in a special way and >> > maybe set a timer to fire and process them as soon as the current >> > throttling period elapses? Might be a patch on top of this I guess. >> >> Setting a timer won't be a good idea at all, as it would need to be a >> deferrable one and Thomas would not like that (I'm sure). >> > > Why deferrable? IMHO, we should be servicing RT requestes as soon as the > HW is capable of. Even a small delay of, say, a couple of ms could be > causing deadline misses. If it is not deferrable, it will wake up the CPU from idle, but that's not a concern here, because we're assuming that the CPU is not idle anyway, so fair enough. >> We could in principle add some special casing around that, like for >> example pass flags to sugov_should_update_freq() and opportunistically >> ignore freq_update_delay_ns if SCHED_CPUFREQ_RT_DL is set in there, >> but that would lead to extra overhead on systems where frequency >> updates happen in-context. >> > > Also, it looks still event driven to me. If the RT task is the only > thing running, nothing will trigger a potential frequency change > re-evaluation before the next tick. If freq_update_delay_ns is opportunistically ignored for SCHED_CPUFREQ_RT_DL set in the flags by sugov_should_update_freq(), then all of the updates with that flag set will cause a frequency update to happen immediately *except* *for* the ones that require us to wait for work_in_progress to become false, but in that case the kthread might trigger an update (eg. by scheduling an irq_work) after it has cleared work_in_progress. No timers needed I guess after all? :-) >> Also the case looks somewhat corner to me to be honest. >> > > Sure. Only thinking about potential problems here. However, playing with > my DL patches I noticed that this can be actually a problem, as for DL, > for example, we trigger a frequency switch when the task wakes up, but > then we don't do anything during the tick (because it doesn't seem to > make sense to do anything :). So, if we missed the opportunity to > increase frequency at enqueue time, the task is hopelessly done. :( > > Anyway, since this looks anyway something that we might want on top of > your patches, I'll play with the idea when refreshing my set and see > what I get. Sounds good. Thanks, Rafael
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web