Re: [PATCH 1/1] timers: internal_add_timer() should update->next_timer if ->active_timers == 0

From: Steven Rostedt
Date: Wed Jan 15 2014 - 15:56:58 EST


On Wed, 15 Jan 2014 18:31:37 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> internal_add_timer(timer) 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@xxxxxxxxxx>

Makes sense.

Reviewed-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

-- Steve

> ---
> kernel/timer.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/timer.c b/kernel/timer.c
> index 6582b82..9492d57 100644
> --- a/kernel/timer.c
> +++ b/kernel/timer.c
> @@ -388,9 +388,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++;
> }
> }
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/