diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-05-10 02:27:54 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-05-10 02:27:54 +0400 |
commit | 8c1056839e808aad728db86d739ffec71d2d1db8 (patch) | |
tree | a6ba76eedc0b570314be5be71017575ec91e74cd /net | |
parent | 788252e6616afc75098397cc6b0bcb5482ad07ac (diff) | |
download | linux-8c1056839e808aad728db86d739ffec71d2d1db8.tar.xz |
[NET] linkwatch: Handle jiffies wrap-around
The test used in the linkwatch does not handle wrap-arounds correctly.
Since the intention of the code is to eliminate bursts of messages we
can afford to delay things up to a second. Using that fact we can
easily handle wrap-arounds by making sure that we don't delay things
by more than one second.
This is based on diagnosis and a patch by Stefan Rompf.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Stefan Rompf <stefan@loplof.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/link_watch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 341de44c7ed1..646937cc2d84 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -170,13 +170,13 @@ void linkwatch_fire_event(struct net_device *dev) spin_unlock_irqrestore(&lweventlist_lock, flags); if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) { - unsigned long thisevent = jiffies; + unsigned long delay = linkwatch_nextevent - jiffies; - if (thisevent >= linkwatch_nextevent) { + /* If we wrap around we'll delay it by at most HZ. */ + if (!delay || delay > HZ) schedule_work(&linkwatch_work); - } else { - schedule_delayed_work(&linkwatch_work, linkwatch_nextevent - thisevent); - } + else + schedule_delayed_work(&linkwatch_work, delay); } } } |