From: Oleg Nesterov <[email protected]>

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 <[email protected]>
Reviewed-by: Steven Rostedt <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
---
 kernel/timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index b9cc28271646..e74685309b14 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -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++;
 }
-- 
1.8.1.5

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

Reply via email to