Re: [patch 13/20] timer: Switch to a non cascading wheel
From: Richard Cochran
Date: Mon Jun 13 2016 - 10:36:57 EST
On Mon, Jun 13, 2016 at 08:41:00AM -0000, Thomas Gleixner wrote:
> +static inline struct timer_base *get_timer_base(u32 tflags)
> +{
> + return get_timer_cpu_base(tflags, tflags & TIMER_BASEMASK);
> +}
This should rather be (tflags & TIMER_CPUMASK) to avoid using
per_cpu_ptr() with the TIMER_MIGRATING bit set in the CPU index.
The one caller in this patch is okay, since it already checks that
TIMER_MIGRATING is clear:
> static struct timer_base *lock_timer_base(struct timer_list *timer,
> - unsigned long *flags)
> + unsigned long *flags)
> __acquires(timer->base->lock)
> {
> for (;;) {
> - u32 tf = timer->flags;
> struct timer_base *base;
> + u32 tf = timer->flags;
>
> if (!(tf & TIMER_MIGRATING)) {
> - base = per_cpu_ptr(&timer_bases, tf & TIMER_CPUMASK);
> + base = get_timer_base(tf);
However, in patch #20, we'll have this in __mod_timer();
/*
* Take the current timer_jiffies of base, but without holding
* the lock!
*/
base = get_timer_base(timer->flags);
Thanks,
Richard