Skip to content

Commit af68cb3

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
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: Anna-Maria Behnsen <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20240221090548.36600-9-anna-maria@linutronix.de
1 parent aae55e9 commit af68cb3

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

kernel/time/timer.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,16 +2180,14 @@ static void run_local_timers(void)
21802180
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
21812181

21822182
hrtimer_run_queues();
2183-
/* Raise the softirq only if required. */
2184-
if (time_before(jiffies, base->next_expiry)) {
2185-
if (!IS_ENABLED(CONFIG_NO_HZ_COMMON))
2186-
return;
2187-
/* CPU is awake, so check the deferrable base. */
2188-
base++;
2189-
if (time_before(jiffies, base->next_expiry))
2183+
2184+
for (int i = 0; i < NR_BASES; i++, base++) {
2185+
/* Raise the softirq only if required. */
2186+
if (time_after_eq(jiffies, base->next_expiry)) {
2187+
raise_softirq(TIMER_SOFTIRQ);
21902188
return;
2189+
}
21912190
}
2192-
raise_softirq(TIMER_SOFTIRQ);
21932191
}
21942192

21952193
/*

0 commit comments

Comments
 (0)