Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] hrtimers: clean up callback tracking

Reintroduce ktimers feature "optimized away" by the ktimers review process:
remove the curr_timer pointer from the cpu-base and use the hrtimer state.

No functional changes.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Thomas Gleixner and committed by
Linus Torvalds
5cfb6de7 303e967f

+1 -10
-1
include/linux/hrtimer.h
··· 136 136 spinlock_t lock; 137 137 struct lock_class_key lock_key; 138 138 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 139 - struct hrtimer *curr_timer; 140 139 }; 141 140 142 141 /*
+1 -9
kernel/hrtimer.c
··· 172 172 */ 173 173 #ifdef CONFIG_SMP 174 174 175 - #define set_curr_timer(b, t) do { (b)->curr_timer = (t); } while (0) 176 - 177 175 /* 178 176 * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock 179 177 * means that all timers which are tied to this base via timer->base are ··· 225 227 * completed. There is no conflict as we hold the lock until 226 228 * the timer is enqueued. 227 229 */ 228 - if (unlikely(base->cpu_base->curr_timer == timer)) 230 + if (unlikely(timer->state & HRTIMER_STATE_CALLBACK)) 229 231 return base; 230 232 231 233 /* See the comment in lock_timer_base() */ ··· 238 240 } 239 241 240 242 #else /* CONFIG_SMP */ 241 - 242 - #define set_curr_timer(b, t) do { } while (0) 243 243 244 244 static inline struct hrtimer_clock_base * 245 245 lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) ··· 666 670 break; 667 671 668 672 fn = timer->function; 669 - set_curr_timer(cpu_base, timer); 670 673 __remove_hrtimer(timer, base, HRTIMER_STATE_CALLBACK); 671 674 spin_unlock_irq(&cpu_base->lock); 672 675 ··· 679 684 enqueue_hrtimer(timer, base); 680 685 } 681 686 } 682 - set_curr_timer(cpu_base, NULL); 683 687 spin_unlock_irq(&cpu_base->lock); 684 688 } 685 689 ··· 865 871 spin_lock(&old_base->lock); 866 872 867 873 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { 868 - BUG_ON(old_base->curr_timer); 869 - 870 874 migrate_hrtimer_list(&old_base->clock_base[i], 871 875 &new_base->clock_base[i]); 872 876 }