History

timers: Track total number of timers in list

Currently, the tvec_base structure's ->active_timers field tracks only the non-deferrable timers, which means that even if ->active_timers is zero, there might well be deferrable timers in the list. This commit therefore adds an ->all_timers field to track all the timers, whether deferrable or not.

Paul E. McKenney committed 12 years ago

Commit fff42151 parent 849401b1 file · +5 −0Browse files

Unified · Split

kernel/timer.c+5−0
@@ -81,6 +81,7 @@ struct tvec_base { · 80 unmodified lines
8181 unsigned long timer_jiffies;
8282 unsigned long next_timer;
8383 unsigned long active_timers;
84+ unsigned long all_timers;
8485 struct tvec_root tv1;
8586 struct tvec tv2;
8687 struct tvec tv3;
@@ -392,6 +393,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) · 305 unmodified lines
392393 base->next_timer = timer->expires;
393394 base->active_timers++;
394395 }
396+ base->all_timers++;
395397 }
396398
397399 #ifdef CONFIG_TIMER_STATS
@@ -671,6 +673,7 @@ detach_expired_timer(struct timer_list *timer, struct tvec_base *base) · 273 unmodified lines
671673 detach_timer(timer, true);
672674 if (!tbase_get_deferrable(timer->base))
673675 base->active_timers--;
676+ base->all_timers--;
674677 }
675678
676679 static int detach_if_pending(struct timer_list *timer, struct tvec_base *base,
@@ -685,6 +688,7 @@ static int detach_if_pending(struct timer_list *timer, struct tvec_base *base, · 8 unmodified lines
685688 if (timer->expires == base->next_timer)
686689 base->next_timer = base->timer_jiffies;
687690 }
691+ base->all_timers--;
688692 return 1;
689693 }
690694
@@ -1559,6 +1563,7 @@ static int init_timers_cpu(int cpu) · 868 unmodified lines
15591563 base->timer_jiffies = jiffies;
15601564 base->next_timer = base->timer_jiffies;
15611565 base->active_timers = 0;
1566+ base->all_timers = 0;
15621567 return 0;
15631568 }
15641569