提交 760559e1 编写于 作者: J Jeff Garzik

[netdrvr 8139too] fast poll for thread, if an unlikely race occurs

The rtl8139 thread is triggered only on rare 8139 hardware, the race
itself is unlikely, and the impact of racing is low.  We don't care
enough to create a more-complex race-free solution.

Rather, if the trylock fails, we now simply poll twice a second until
we do get the lock.
上级 2f67bdb2
...@@ -1598,13 +1598,19 @@ static void rtl8139_thread (void *_data) ...@@ -1598,13 +1598,19 @@ static void rtl8139_thread (void *_data)
{ {
struct net_device *dev = _data; struct net_device *dev = _data;
struct rtl8139_private *tp = netdev_priv(dev); struct rtl8139_private *tp = netdev_priv(dev);
unsigned long thr_delay;
if (rtnl_shlock_nowait() == 0) { if (rtnl_shlock_nowait() == 0) {
rtl8139_thread_iter (dev, tp, tp->mmio_addr); rtl8139_thread_iter (dev, tp, tp->mmio_addr);
rtnl_unlock (); rtnl_unlock ();
thr_delay = next_tick;
} else {
/* unlikely race. mitigate with fast poll. */
thr_delay = HZ / 2;
} }
schedule_delayed_work(&tp->thread, next_tick); schedule_delayed_work(&tp->thread, thr_delay);
} }
static void rtl8139_start_thread(struct rtl8139_private *tp) static void rtl8139_start_thread(struct rtl8139_private *tp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册