netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yejune Deng <yejune.deng@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andriin@fb.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Taehee Yoo" <ap420073@gmail.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Cong Wang" <xiyou.wangcong@gmail.com>,
	"Jiri Pirko" <jiri@mellanox.com>, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: core: fix msleep() is not accurate
Date: Fri, 11 Dec 2020 10:43:54 +0800	[thread overview]
Message-ID: <CABWKuGVvh93zNYky_Lj2Hyenoerm+PBj38ocfYcw0k0_en=7Lg@mail.gmail.com> (raw)
In-Reply-To: <CANn89iKW4cLMssB2zi8kvikddVHMXfQLDr9Gkg768Ou3H5VwiA@mail.gmail.com>

Does anyone else have a different opinion? If not,I will adopt it and resubmit.

On Thu, Dec 10, 2020 at 6:19 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Thu, Dec 10, 2020 at 10:35 AM Yejune Deng <yejune.deng@gmail.com> wrote:
> >
> > See Documentation/timers/timers-howto.rst, msleep() is not
> > for (1ms - 20ms), There is a more advanced API is used.
> >
> > Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> > ---
> >  net/core/dev.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index d33099f..6e83ee03 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -6726,9 +6726,9 @@ void napi_disable(struct napi_struct *n)
> >         set_bit(NAPI_STATE_DISABLE, &n->state);
> >
> >         while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
> > -               msleep(1);
> > +               fsleep(1000);
> >         while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
> > -               msleep(1);
> > +               fsleep(1000);
> >
>
> I would prefer explicit usleep_range().
>
> fsleep() is not common in the kernel, I had to go to its definition.
>
> I would argue that we should  use usleep_range(10, 200)  to have an
> opportunity to spend less time in napi_disable() in some cases.

  reply	other threads:[~2020-12-11  2:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  9:35 [PATCH] net: core: fix msleep() is not accurate Yejune Deng
2020-12-10 10:19 ` Eric Dumazet
2020-12-11  2:43   ` Yejune Deng [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-15  2:04 Yejune Deng
2020-12-16 19:33 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABWKuGVvh93zNYky_Lj2Hyenoerm+PBj38ocfYcw0k0_en=7Lg@mail.gmail.com' \
    --to=yejune.deng@gmail.com \
    --cc=andriin@fb.com \
    --cc=ap420073@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).