提交 8c105683 编写于 作者: H Herbert Xu 提交者: David S. Miller

[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: NHerbert Xu <herbert@gondor.apana.org.au>
Acked-by: NStefan Rompf <stefan@loplof.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 788252e6
......@@ -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);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册