Re: [patch V2 06/10] timer: Restructure internal locking

From: Peter Zijlstra
Date: Wed Apr 19 2017 - 03:07:22 EST


On Tue, Apr 18, 2017 at 01:11:08PM +0200, Thomas Gleixner wrote:

> +++ b/kernel/time/timer.c
> @@ -1651,17 +1651,14 @@ void update_process_times(int user_tick)
> /**
> * __run_timers - run all expired timers (if any) on this CPU.
> * @base: the timer vector to be processed.
> + *
> + * Caller must hold the base lock.
> */
> static inline void __run_timers(struct timer_base *base)
> {
> struct hlist_head heads[LVL_DEPTH];
> int levels;
>
> - if (!time_after_eq(jiffies, base->clk))
> - return;
> -
> - spin_lock_irq(&base->lock);
> -

lockdep_assert_held(&base->lock);


Is so ever much more useful than a comment.

> while (time_after_eq(jiffies, base->clk)) {
>
> levels = collect_expired_timers(base, heads);