Re: [RFC PATCH] hrtimer: interleave timers for improved single thread performance at low utilization

From: shrikanth hegde
Date: Tue Jan 31 2023 - 10:51:35 EST




On 1/31/23 8:25 PM, Arjan van de Ven wrote:
>
>>   kernel/time/hrtimer.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
>> index 3ae661ab6260..d160f49f0cce 100644
>> --- a/kernel/time/hrtimer.c
>> +++ b/kernel/time/hrtimer.c
>> @@ -1055,6 +1055,17 @@ u64 hrtimer_forward(struct hrtimer *timer,
>> ktime_t now, ktime_t interval)
>>
>>           orun = ktime_divns(delta, incr);
>>           hrtimer_add_expires_ns(timer, incr * orun);
>> +        /*
>> +         * Avoid timer round-off, so that all cfs bandwidth timers
>> +         * don't start at the same time
>
> so while I applaud the final objective, I am sort of wondering if
> hrtimer.c is the right place in the kernel to fix a CFS/cgroup issue...
> wouldn't it be better to solve such issues at the place we want this to
> happen, rather than for all timers in the whole system?
>
Agree. It was an initial approach to the problem. This can be fixed in scheduler
code itself as suggested by Ingo. Will send out that patch soon.
> (also while for performance it might be better to spread out a bit, for
> power consumption it's obviously the other way around)
>
This would be performance vs power comparison. Would get both the
numbers next time for fairer comparison.