Fold the rebind counter and traffic flags into one atomic word - #1820
Open
nbrownus wants to merge 2 commits into
Open
Fold the rebind counter and traffic flags into one atomic word#1820nbrownus wants to merge 2 commits into
nbrownus wants to merge 2 commits into
Conversation
JackDoan
self-requested a review
July 24, 2026 16:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduces the size of the
HostInfostruct (shaved 24 bytes off on my computer) and fixes a known/accepted data race withrebindCountwhich is more interesting now that we are using it on more than just iOS.The
HostInforeduction comes about by turning manyatomic.Bools into a singleatomic.Uint32(which is what anatomic.Boolis under the hood) and ordering the struct to reduce padding.rebindCountsafety comes about because 29 bits of theatomic.Uint32are allocated for it instead of the old rawuint8vialastRebindCount, and it becomes an atomic for free.The rebind counter comparison is handled in
ConnectionManager.Outnow in the same atomic operation that records outbound traffic.There was no change in throughput or CPU in my linux perf tests (a c8a.16xlarge server with 16 c8a.xlarge clients running iperf/reverse iperf for 5 minutes. I do expect some memory savings on highly connected hosts.