Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253180
b: refs/heads/master
c: 1c3cc11
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Thomas Gleixner committed Jun 3, 2011
1 parent ccdef6f commit 7f0c8e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b054b67d3bfc6dca9f634c104780f3f24ff3eec
refs/heads/master: 1c3cc11602111d1318c2a5743bd2e88c82813927
15 changes: 7 additions & 8 deletions trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,16 +749,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
unsigned long expires_limit, mask;
int bit;

expires_limit = expires;

if (timer->slack >= 0) {
expires_limit = expires + timer->slack;
} else {
unsigned long now = jiffies;
long delta = expires - jiffies;

if (delta < 256)
return expires;

/* No slack, if already expired else auto slack 0.4% */
if (time_after(expires, now))
expires_limit = expires + (expires - now)/256;
expires_limit = expires + delta / 256;
}
mask = expires ^ expires_limit;
if (mask == 0)
Expand Down Expand Up @@ -795,6 +794,8 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
*/
int mod_timer(struct timer_list *timer, unsigned long expires)
{
expires = apply_slack(timer, expires);

/*
* This is a common optimization triggered by the
* networking code - if the timer is re-modified
Expand All @@ -803,8 +804,6 @@ int mod_timer(struct timer_list *timer, unsigned long expires)
if (timer_pending(timer) && timer->expires == expires)
return 1;

expires = apply_slack(timer, expires);

return __mod_timer(timer, expires, false, TIMER_NOT_PINNED);
}
EXPORT_SYMBOL(mod_timer);
Expand Down

0 comments on commit 7f0c8e5

Please sign in to comment.