Skip to content

device,tun: release completed packet references - #105

Draft
unisequence wants to merge 1 commit into
tailscale:tailscalefrom
unisequence:lowmem/release-packet-references
Draft

unisequence wants to merge 1 commit into
tailscale:tailscalefrom
unisequence:lowmem/release-packet-references

Conversation

@unisequence

Copy link
Copy Markdown

After synchronous TUN writes and completed send/receive batches, reusable scratch slices can still point at the finished packet buffers. Under the opt-in ts_lowmem_release build tag, clear those references while retaining reusable slice storage and the GRO virtio header. The default build uses no-op helpers.

This is intended to let the garbage collector reclaim packet slabs after traffic becomes idle. The tradeoff is a small per-batch clearing cost. It does not change the packet bytes or the WireGuard protocol. This PR is independent of the separate lazy GRO capacity change.

Validation: go test -tags ts_lowmem_release ./tun ./device; default go test ./tun ./device. The tagged GRO reset test checks that completed packet references are released across alternating full and short batches. Further device-level error/stop-path assertions would improve coverage before merge.

Signed-off-by: Murad Rabadanov <the21.21@mail.ru>
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.

1 participant