On Fri, 24 Sep 2021 07:30:30 -0700 Eric Dumazet wrote:
quoted
void napi_disable(struct napi_struct *n)
{
+ unsigned long val, new;
+
might_sleep();
set_bit(NAPI_STATE_DISABLE, &n->state);
- while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
- msleep(1);
- while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
- msleep(1);
+ do {
+ val = READ_ONCE(n->state);
+ if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
+ msleep(1);
Patch seems good to me.
We also could replace this pessimistic msleep(1) with more opportunistic usleep_range(20, 200)
Will do, thanks!