Skip to content

conn: coalesce via scatter-gather writes#51

Merged
illotum merged 1 commit intotailscalefrom
illotum/scatter-gather-conn-writes
Apr 8, 2026
Merged

conn: coalesce via scatter-gather writes#51
illotum merged 1 commit intotailscalefrom
illotum/scatter-gather-conn-writes

Conversation

@illotum
Copy link
Copy Markdown

@illotum illotum commented Apr 2, 2026

Port of tailscale/tailscale#19054

On Linux BindStd will now write a vector of
coalesced buffers via sendmmsg(2) instead of copying fragments into a single buffer.

Updates tailscale/corp#36989

@illotum illotum marked this pull request as ready for review April 2, 2026 16:33
Copilot AI review requested due to automatic review settings April 2, 2026 16:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports tailscale/tailscale#19054 to change Linux UDP GSO batching to coalesce datagrams using scatter-gather (sendmmsg(2) iovecs) instead of copying fragments into a single contiguous buffer, reducing per-packet copying.

Changes:

  • Update coalesceMessages to append additional datagram payloads as additional ipv6.Message.Buffers entries (scatter-gather) while tracking total coalesced payload length.
  • Adjust message pooling cleanup to keep Buffers[0] accessible after coalescing.
  • Update Test_coalesceMessages expectations to validate per-iovec buffer lengths rather than a single concatenated buffer length.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
conn/bind_std.go Switch coalescing from copy-append into a single buffer to scatter-gather iovec appends for Linux WriteBatch.
conn/bind_std_test.go Update coalescing tests to assert the shape/lengths of Message.Buffers after scatter-gather coalescing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

On Linux BindStd will now write a vector of
coalesced buffers via sendmmsg(2) instead of copying
fragments into a single buffer.

Updates tailscale/corp#36989

Signed-off-by: Alex Valiushko <alexvaliushko@tailscale.com>
@illotum illotum force-pushed the illotum/scatter-gather-conn-writes branch from 536c090 to 0f195ee Compare April 2, 2026 16:53
@illotum illotum requested a review from jwhited April 2, 2026 18:50
@illotum illotum merged commit cd4feb8 into tailscale Apr 8, 2026
13 checks passed
@illotum illotum deleted the illotum/scatter-gather-conn-writes branch April 8, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants