-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test PR To Trigger CI #8667
Closed
jrife
wants to merge
4
commits into
kernel-patches:bpf-next_base
from
jrife:jrife/socket-iterators-tcp-udp
Closed
Test PR To Trigger CI #8667
jrife
wants to merge
4
commits into
kernel-patches:bpf-next_base
from
jrife:jrife/socket-iterators-tcp-udp
+523
−48
Conversation
This file contains 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
fff693a
to
ecf16c9
Compare
ecf16c9
to
10828f2
Compare
Replace the offset-based approach for tracking progress through a bucket in the UDP table with one based on unique, monotonically increasing index numbers associated with each socket in a bucket. * Assign index numbers on sockets in the bucket's linked list such that they are monotonically increasing as you read from the head to tail: * Every time a socket is added to a bucket, increment the hash table's version number, ver. * If the socket is being added to the head of the bucket's linked list, set sk->idx to -1*ver. * If the socket is being added to the tail of the bucket's linked list, set sk->idx to ver. Ex: append_head(C), append_head(B), append_tail(D), append_head(A), append_tail(E) results in the following state. A -> B -> C -> D -> E -4 -2 -1 3 5 * As we iterate through a bucket keep track of the last index number we've seen for that bucket (iter->prev_idx). * Use iter->prev_idx on subsequent iterations to pick up where we left off. Since we always iterate from head to tail and indexes are always increasing in that direction we can be sure that any socket whose index is greater than iter->prev_idx has not yet been seen. Any socket whose index is less than iter->prev_idx has either been seen before or was added after we began iterating over that bucket. In either case, it's safe to skip them.
10828f2
to
7e21cfb
Compare
44c3a1d
to
720c696
Compare
Replace the offset-based approach for tracking progress through a bucket in the TCP table with one based on unique, monotonically increasing index numbers associated with each socket in a bucket. * Assign index numbers on sockets in the bucket's linked list such that they are monotonically increasing as you read from the head to tail: * Every time a socket is added to a bucket, increment the hash table's version number, ver. * If the socket is being added to the head of the bucket's linked list, set sk->idx to -1*ver. * If the socket is being added to the tail of the bucket's linked list, set sk->idx to ver. Ex: append_head(C), append_head(B), append_tail(D), append_head(A), append_tail(E) results in the following state. A -> B -> C -> D -> E -4 -2 -1 3 5 * As we iterate through a bucket keep track of the last index number we've seen for that bucket (iter->prev_idx). * Use iter->prev_idx on subsequent iterations to pick up where we left off. Since we always iterate from head to tail and indexes are always increasing in that direction we can be sure that any socket whose index is greater than iter->prev_idx has not yet been seen. Any socket whose index is less than iter->prev_idx has either been seen before or was added after we began iterating over that bucket. In either case, it's safe to skip them.
7e21cfb
to
a8a5ff6
Compare
Add do_skip_test() and do_repeat_test() subtests to the sock_iter_batch prog_test to check for socket skips and repeats, respectively. Extend the sock_iter_batch BPF program to output the socket cookie as well, so that we can check for uniqueness. The skip test works by partially iterating through a bucket, then closing one of the sockets that have already been seen to remove it from the bucket. Before, this would have resulted in skipping the fourth socket. Now, the fourth socket is seen. The repeat test works by partially iterating through a bucket, then adding four more sockets to the head of the bucket. Before, this would have resulted in repeating several of the sockets from the first batch, but now we see sockets exactly once.
a8a5ff6
to
0dbe2cd
Compare
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.
WIP