linux/include
Eric Dumazet 133c4c0d37 tcp: defer regular ACK while processing socket backlog
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: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Dave Taht <dave.taht@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-09-12 19:10:01 +02:00
..
acpi
asm-generic ata changes for 6.6 2023-09-05 12:37:28 -07:00
clocksource
crypto This update includes the following changes: 2023-08-29 11:23:29 -07:00
drm drm for 6.6-rc1 2023-08-30 13:34:34 -07:00
dt-bindings IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
keys
kunit - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
kvm
linux tcp: defer regular ACK while processing socket backlog 2023-09-12 19:10:01 +02:00
math-emu
media media updates for v6.6-rc1 2023-09-01 12:21:32 -07:00
memory
misc
net tcp: defer regular ACK while processing socket backlog 2023-09-12 19:10:01 +02:00
pcmcia
ras
rdma
rv rv: Set variable 'da_mon_##name' to static 2023-09-01 21:00:00 -04:00
scsi SCSI misc on 20230902 2023-09-02 12:02:41 -07:00
soc IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
sound ASoC: Updates for v6.6 2023-08-28 16:13:03 +02:00
target
trace tracing: Replace strlcpy with strscpy in trace/events/task.h 2023-09-01 21:00:00 -04:00
uapi Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
ufs Merge branch 'fixes' into misc 2023-09-02 08:25:19 +01:00
vdso
video
xen dma-maping updates for Linux 6.6 2023-08-29 20:32:10 -07:00