Skip to content

Commit

Permalink
timers: Make internal_add_timer() update ->next_timer if ->active_tim…
Browse files Browse the repository at this point in the history
…ers == 0

The internal_add_timer() function updates base->next_timer only if
timer->expires < base->next_timer. This is correct, but it also makes
sense to do the same if we add the first non-deferrable timer.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
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>
Tested-by: Mike Galbraith <bitbucket@online.de>
  • Loading branch information
Oleg Nesterov authored and Paul E. McKenney committed Feb 25, 2014
1 parent 18d8cb6 commit aea369b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
* Update base->active_timers and base->next_timer
*/
if (!tbase_get_deferrable(timer->base)) {
if (time_before(timer->expires, base->next_timer))
if (!base->active_timers++ ||
time_before(timer->expires, base->next_timer))
base->next_timer = timer->expires;
base->active_timers++;
}
base->all_timers++;
}
Expand Down

0 comments on commit aea369b

Please sign in to comment.