From: Soheil Hassas Yeganeh <soheil@google.com>
To: Neal Cardwell <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Yuchung Cheng <ycheng@google.com>
Subject: Re: [RFC net-next 4/4] tcp: defer regular ACK while processing socket backlog
Date: Thu, 7 Sep 2023 10:35:41 -0400 [thread overview]
Message-ID: <CACSApvaDEvRFdvd7X_-Jcw+uUHD775uM2TyVg383ecLE2CMV8g@mail.gmail.com> (raw)
In-Reply-To: <CADVnQynzDw6JK7CTtyTrNWiYENmOi12i9XXpEQ-+eB-dEg3fvQ@mail.gmail.com>
On Thu, Sep 7, 2023 at 10:08 AM Neal Cardwell <ncardwell@google.com> wrote:
>
> On Wed, Sep 6, 2023 at 4:10 PM Eric Dumazet <edumazet@google.com> wrote:
> >
> > This idea came after a particular workload requested
> > the quickack attribute set on routes, and a performance
> > drop was noticed for large bulk transfers.
> >
> > For high throughput flows, it is best to use one cpu
> > running the user thread issuing socket system calls,
> > and a separate cpu to process incoming packets from BH context.
> > (With TSO/GRO, bottleneck is usually the 'user' cpu)
> >
> > Problem is the user thread can spend a lot of time while holding
> > the socket lock, forcing BH handler to queue most of incoming
> > packets in the socket backlog.
> >
> > Whenever the user thread releases the socket lock, it must first
> > process all accumulated packets in the backlog, potentially
> > adding latency spikes. Due to flood mitigation, having too many
> > packets in the backlog increases chance of unexpected drops.
> >
> > Backlog processing unfortunately shifts a fair amount of cpu cycles
> > from the BH cpu to the 'user' cpu, thus reducing max throughput.
> >
> > This patch takes advantage of the backlog processing,
> > and the fact that ACK are mostly cumulative.
> >
> > The idea is to detect we are in the backlog processing
> > and defer all eligible ACK into a single one,
> > sent from tcp_release_cb().
> >
> > This saves cpu cycles on both sides, and network resources.
> >
> > Performance of a single TCP flow on a 200Gbit NIC:
> >
> > - Throughput is increased by 20% (100Gbit -> 120Gbit).
> > - Number of generated ACK per second shrinks from 240,000 to 40,000.
> > - Number of backlog drops per second shrinks from 230 to 0.
> >
> > Benchmark context:
> > - Regular netperf TCP_STREAM (no zerocopy)
> > - Intel(R) Xeon(R) Platinum 8481C (Saphire Rapids)
> > - MAX_SKB_FRAGS = 17 (~60KB per GRO packet)
> >
> > This feature is guarded by a new sysctl, and enabled by default:
> > /proc/sys/net/ipv4/tcp_backlog_ack_defer
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Acked-by: Neal Cardwell <ncardwell@google.com>
>
> Yet another fantastic optimization. Thanks, Eric!
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
This is really superb! Thank you, Eric!
> neal
next prev parent reply other threads:[~2023-09-07 15:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 20:10 [RFC net-next 0/4] tcp: backlog processing optims Eric Dumazet
2023-09-06 20:10 ` [RFC net-next 1/4] tcp: no longer release socket ownership in tcp_release_cb() Eric Dumazet
2023-09-06 20:10 ` [RFC net-next 2/4] net: sock_release_ownership() cleanup Eric Dumazet
2023-09-06 20:10 ` [RFC net-next 3/4] net: call prot->release_cb() when processing backlog Eric Dumazet
2023-09-06 20:10 ` [RFC net-next 4/4] tcp: defer regular ACK while processing socket backlog Eric Dumazet
2023-09-06 20:31 ` Yuchung Cheng
2023-09-06 23:07 ` Stephen Hemminger
2023-09-07 14:07 ` Neal Cardwell
2023-09-07 14:35 ` Soheil Hassas Yeganeh [this message]
[not found] ` <CAA93jw7Fuov-vmxiZdW7My-AVWCOFQo4XVm9bNwAg4Td2CUNCA@mail.gmail.com>
2023-09-07 16:54 ` Eric Dumazet
2023-09-07 17:09 ` Jakub Kicinski
2023-09-07 17:16 ` Eric Dumazet
2023-09-07 18:00 ` Jakub Kicinski
2023-09-07 18:05 ` Eric Dumazet
2023-09-07 18:10 ` 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=CACSApvaDEvRFdvd7X_-Jcw+uUHD775uM2TyVg383ecLE2CMV8g@mail.gmail.com \
--to=soheil@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ycheng@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).