Skip to content

Commit 57e95a5

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
timers: Introduce function to check timer base is_idle flag
To prepare for the conversion of the NOHZ timer placement to a pull at expiry time model it's required to have a function that returns the value of the is_idle flag of the timer base to keep the hierarchy states during online in sync with timer base state. 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-18-anna-maria@linutronix.de
1 parent 4c53293 commit 57e95a5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

kernel/time/tick-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ extern void fetch_next_timer_interrupt_remote(unsigned long basej, u64 basem,
165165
unsigned int cpu);
166166
extern void timer_lock_remote_bases(unsigned int cpu);
167167
extern void timer_unlock_remote_bases(unsigned int cpu);
168+
extern bool timer_base_is_idle(void);
168169
# endif
169170
#else /* CONFIG_NO_HZ_COMMON */
170171
static inline void timers_update_nohz(void) { }

kernel/time/timer.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,16 @@ void timer_lock_remote_bases(unsigned int cpu)
21592159
raw_spin_lock(&base_local->lock);
21602160
raw_spin_lock_nested(&base_global->lock, SINGLE_DEPTH_NESTING);
21612161
}
2162+
2163+
/**
2164+
* timer_base_is_idle() - Return whether timer base is set idle
2165+
*
2166+
* Returns value of local timer base is_idle value.
2167+
*/
2168+
bool timer_base_is_idle(void)
2169+
{
2170+
return __this_cpu_read(timer_bases[BASE_LOCAL].is_idle);
2171+
}
21622172
# endif /* CONFIG_SMP */
21632173

21642174
static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem,

0 commit comments

Comments
 (0)