Commit fff42158 authored by Paul E. McKenney's avatar Paul E. McKenney

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.
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
Reviewed-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Tested-by: default avatarMike Galbraith <bitbucket@online.de>
parent 849401b6
...@@ -81,6 +81,7 @@ struct tvec_base { ...@@ -81,6 +81,7 @@ struct tvec_base {
unsigned long timer_jiffies; unsigned long timer_jiffies;
unsigned long next_timer; unsigned long next_timer;
unsigned long active_timers; unsigned long active_timers;
unsigned long all_timers;
struct tvec_root tv1; struct tvec_root tv1;
struct tvec tv2; struct tvec tv2;
struct tvec tv3; struct tvec tv3;
...@@ -392,6 +393,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) ...@@ -392,6 +393,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
base->next_timer = timer->expires; base->next_timer = timer->expires;
base->active_timers++; base->active_timers++;
} }
base->all_timers++;
} }
#ifdef CONFIG_TIMER_STATS #ifdef CONFIG_TIMER_STATS
...@@ -671,6 +673,7 @@ detach_expired_timer(struct timer_list *timer, struct tvec_base *base) ...@@ -671,6 +673,7 @@ detach_expired_timer(struct timer_list *timer, struct tvec_base *base)
detach_timer(timer, true); detach_timer(timer, true);
if (!tbase_get_deferrable(timer->base)) if (!tbase_get_deferrable(timer->base))
base->active_timers--; base->active_timers--;
base->all_timers--;
} }
static int detach_if_pending(struct timer_list *timer, struct tvec_base *base, 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, ...@@ -685,6 +688,7 @@ static int detach_if_pending(struct timer_list *timer, struct tvec_base *base,
if (timer->expires == base->next_timer) if (timer->expires == base->next_timer)
base->next_timer = base->timer_jiffies; base->next_timer = base->timer_jiffies;
} }
base->all_timers--;
return 1; return 1;
} }
...@@ -1559,6 +1563,7 @@ static int init_timers_cpu(int cpu) ...@@ -1559,6 +1563,7 @@ static int init_timers_cpu(int cpu)
base->timer_jiffies = jiffies; base->timer_jiffies = jiffies;
base->next_timer = base->timer_jiffies; base->next_timer = base->timer_jiffies;
base->active_timers = 0; base->active_timers = 0;
base->all_timers = 0;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment