mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-09 14:05:36 +09:00
gVisor host GSO and GRO have only been enabled on Linux. Without GSO, netstack hands tstun one MTU-sized packet at a time, so wireguard-go sees batches of one and every UDP send is its own syscall, which is the dominant cost in tailcat and userspace-networking profiles on macOS now that the send path can batch. With GSO, tstun splits each super-packet into per-MTU segments and wireguard-go gets batches of up to 128, which flow through to sendmsg_x (macOS) or sendmmsg (Linux). TS_DEBUG_NETSTACK_GSO=1 turns GSO and GRO on for other platforms and makes tstun report a vector batch size so the wireguard-go packet slab is large enough for the split. Measured with tailcat perf between two M5 Pro Mac minis on a 10 Gbps LAN, with connected per-peer sockets and msgx also enabled: stock tailcat 0.92 Gbps connected sockets + msgx 2.5 Gbps connected sockets + GSO/GRO, no msgx 3.5 Gbps connected sockets + msgx + GSO/GRO 4.6 Gbps CPU per gigabyte on each end drops from about 21 s to about 4 s. This is an evaluation knob; it should become the default on macOS (and be tried on Windows, see tailscale/corp#21874) once soaked. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: I9a2f6c1e4d7b3085c2e9f1a6d4b7c3e8f5a1d2b9