Skip to content

Commit

Permalink
timers: Fix slack calculation for expired timers
Browse files Browse the repository at this point in the history
commit 3bbb9ec (timers: Introduce the concept of timer slack for
legacy timers) does not take the case into account when the timer is
already expired. This broke wireless drivers.

The solution is not to apply slack to already expired timers.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Arjan van de Ven <[email protected]>
  • Loading branch information
jeffersonchua authored and KAGA-KOKO committed May 24, 2010
1 parent bd45b7a commit f00e047
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,13 +750,14 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
unsigned long expires_limit, mask;
int bit;

expires_limit = expires + timer->slack;
expires_limit = expires;

if (timer->slack < 0) /* auto slack: use 0.4% */
if (timer->slack > -1)
expires_limit = expires + timer->slack;
else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */
expires_limit = expires + (expires - jiffies)/256;

mask = expires ^ expires_limit;

if (mask == 0)
return expires;

Expand Down

0 comments on commit f00e047

Please sign in to comment.