diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-01-14 23:20:43 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-02-25 15:38:59 -0500 |
commit | fff421580f512fc044cc7421fdff31a7a6997350 (patch) | |
tree | 622758922122630ea7ac051a5d393a8bd4e7b34f /kernel/timer.c | |
parent | 849401b66d305f3feb75b6db7459b95ad190552a (diff) |
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: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Mike Galbraith <bitbucket@online.de>
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index accfd241b9e5..fdc43834f3af 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -81,6 +81,7 @@ struct tvec_base { | |||
81 | unsigned long timer_jiffies; | 81 | unsigned long timer_jiffies; |
82 | unsigned long next_timer; | 82 | unsigned long next_timer; |
83 | unsigned long active_timers; | 83 | unsigned long active_timers; |
84 | unsigned long all_timers; | ||
84 | struct tvec_root tv1; | 85 | struct tvec_root tv1; |
85 | struct tvec tv2; | 86 | struct tvec tv2; |
86 | struct tvec tv3; | 87 | struct tvec tv3; |
@@ -392,6 +393,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) | |||
392 | base->next_timer = timer->expires; | 393 | base->next_timer = timer->expires; |
393 | base->active_timers++; | 394 | base->active_timers++; |
394 | } | 395 | } |
396 | base->all_timers++; | ||
395 | } | 397 | } |
396 | 398 | ||
397 | #ifdef CONFIG_TIMER_STATS | 399 | #ifdef CONFIG_TIMER_STATS |
@@ -671,6 +673,7 @@ detach_expired_timer(struct timer_list *timer, struct tvec_base *base) | |||
671 | detach_timer(timer, true); | 673 | detach_timer(timer, true); |
672 | if (!tbase_get_deferrable(timer->base)) | 674 | if (!tbase_get_deferrable(timer->base)) |
673 | base->active_timers--; | 675 | base->active_timers--; |
676 | base->all_timers--; | ||
674 | } | 677 | } |
675 | 678 | ||
676 | static int detach_if_pending(struct timer_list *timer, struct tvec_base *base, | 679 | 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 | if (timer->expires == base->next_timer) | 688 | if (timer->expires == base->next_timer) |
686 | base->next_timer = base->timer_jiffies; | 689 | base->next_timer = base->timer_jiffies; |
687 | } | 690 | } |
691 | base->all_timers--; | ||
688 | return 1; | 692 | return 1; |
689 | } | 693 | } |
690 | 694 | ||
@@ -1559,6 +1563,7 @@ static int init_timers_cpu(int cpu) | |||
1559 | base->timer_jiffies = jiffies; | 1563 | base->timer_jiffies = jiffies; |
1560 | base->next_timer = base->timer_jiffies; | 1564 | base->next_timer = base->timer_jiffies; |
1561 | base->active_timers = 0; | 1565 | base->active_timers = 0; |
1566 | base->all_timers = 0; | ||
1562 | return 0; | 1567 | return 0; |
1563 | } | 1568 | } |
1564 | 1569 | ||