linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Joe Damato <jdamato@fastly.com>
Cc: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>,
	Eric Dumazet <edumazet@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	chuck.lever@oracle.com, jlayton@kernel.org,
	linux-api@vger.kernel.org, brauner@kernel.org,
	davem@davemloft.net, alexander.duyck@gmail.com,
	Wei Wang <weiwan@google.com>,
	Amritha Nambiar <amritha.nambiar@intel.com>
Subject: Re: [net-next 0/3] Per epoll context busy poll support
Date: Fri, 2 Feb 2024 17:15:39 -0800	[thread overview]
Message-ID: <20240202171539.7347cb01@kernel.org> (raw)
In-Reply-To: <20240202202344.GA9283@fastly.com>

On Fri, 2 Feb 2024 12:23:44 -0800 Joe Damato wrote:
> > Did you see SO_PREFER_BUSY_POLL by any chance? (In combination with
> > gro_flush_timeout IIRC). We added it a while back with Bjorn, it seems
> > like a great idea to me at the time but I'm unclear if anyone uses it 
> > in production..  
> 
> I have seen it while reading the code, yes. I think maybe I missed
> something about its interaction with gro_flush_timeout. In my use case,
> the machine has no traffic until after the app is started.
> 
> In this case, I haven't needed to worry about regular NAPI monopolizing the
> CPU and preventing busy poll from working.
> 
> Maybe I am missing something more nuanced, though? I'll have another look
> at the code, just incase.

We reused the gro_flush_timeout as an existing "user doesn't care if
packets get delayed by this much in worst case" value. If you set
SO_PREFER_BUSY_POLL the next time you busy pool the NAPI will be marked 
as "already scheduled" and a timer is set (to gro_flush_timeout).
If NIC IRQ fires before gro_flush_timeout it gets ignored, because NAPI
is already marked as scheduled.
If you busy poll again the timer gets postponed for another
gro_flush_timeout nsec.
If timer fires we go back to normal NAPI processing.

The idea is that you set gro_flush_timeout to some high value, like 
10 msec, and expect your app to poll more often than every 10 msec. 

Then the normal NAPI processing will never kick in, and there will 
be only 1 NIC IRQ after which the HW IRQ remains masked.
With high coalescing timer you technically still get an IRQ every
so often and interrupt the app. Worst case (UDP flood) you may even
get into an overload where the app gets starved out completely..

  parent reply	other threads:[~2024-02-03  1:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  2:53 [net-next 0/3] Per epoll context busy poll support Joe Damato
2024-01-24  2:53 ` [net-next 1/3] eventpoll: support busy poll per epoll instance Joe Damato
2024-01-24  2:53 ` [net-next 2/3] eventpoll: Add per-epoll busy poll packet budget Joe Damato
2024-01-24  2:53 ` [net-next 3/3] eventpoll: Add epoll ioctl for epoll_params Joe Damato
2024-01-24 15:37   ` Joe Damato
2024-01-24  8:20 ` [net-next 0/3] Per epoll context busy poll support Eric Dumazet
2024-01-24 14:20   ` Joe Damato
2024-01-24 14:38     ` Eric Dumazet
2024-01-24 15:19       ` Joe Damato
2024-01-30 18:54   ` Samudrala, Sridhar
2024-02-02  3:28     ` Joe Damato
2024-02-02 17:23       ` Samudrala, Sridhar
2024-02-02 18:22         ` Jakub Kicinski
2024-02-02 19:33           ` Joe Damato
2024-02-02 19:58             ` Jakub Kicinski
2024-02-02 20:23               ` Joe Damato
2024-02-02 20:50                 ` Samudrala, Sridhar
2024-02-02 20:55                   ` Joe Damato
2024-02-03  1:15                 ` Jakub Kicinski [this message]
2024-02-05 18:17                   ` Stanislav Fomichev
2024-02-05 18:52                     ` Joe Damato
2024-02-05 19:48                       ` Jakub Kicinski
2024-02-05 18:51                   ` Joe Damato
2024-02-05 19:59                     ` 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=20240202171539.7347cb01@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexander.duyck@gmail.com \
    --cc=amritha.nambiar@intel.com \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jdamato@fastly.com \
    --cc=jlayton@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --cc=weiwan@google.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).