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

From: Arjan van de Ven
Date: Tue Jan 31 2023 - 09:56:10 EST



 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?

(also while for performance it might be better to spread out a bit, for power consumption it's obviously the other way around)