Commit af68cb3f authored by Anna-Maria Behnsen's avatar Anna-Maria Behnsen Committed by Thomas Gleixner

timers: Simplify code in run_local_timers()

The logic for raising a softirq the way it is implemented right now, is
readable for two timer bases. When increasing the number of timer bases,
code gets harder to read. With the introduction of the timer migration
hierarchy, there will be three timer bases.

Therefore restructure the code to use a loop. No functional change.
Signed-off-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20240221090548.36600-9-anna-maria@linutronix.de
parent aae55e9f
...@@ -2180,16 +2180,14 @@ static void run_local_timers(void) ...@@ -2180,16 +2180,14 @@ static void run_local_timers(void)
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
hrtimer_run_queues(); hrtimer_run_queues();
/* Raise the softirq only if required. */
if (time_before(jiffies, base->next_expiry)) { for (int i = 0; i < NR_BASES; i++, base++) {
if (!IS_ENABLED(CONFIG_NO_HZ_COMMON)) /* Raise the softirq only if required. */
return; if (time_after_eq(jiffies, base->next_expiry)) {
/* CPU is awake, so check the deferrable base. */ raise_softirq(TIMER_SOFTIRQ);
base++;
if (time_before(jiffies, base->next_expiry))
return; return;
}
} }
raise_softirq(TIMER_SOFTIRQ);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment