[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210924132136.6f867a57@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 24 Sep 2021 13:21:36 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, weiwan@...gle.com,
xuanzhuo@...ux.alibaba.com
Subject: Re: [PATCH net-next] net: make napi_disable() symmetric with enable
On Fri, 24 Sep 2021 07:30:30 -0700 Eric Dumazet wrote:
> > 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!
Powered by blists - more mailing lists