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

From: Oleg Nesterov
Date: Wed Jan 15 2014 - 12:32:09 EST


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>
---
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++;
}
}

--
1.5.5.1


--
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/