You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bpf: udp: Avoid socket skips and repeats during iteration
Replace the offset-based approach for tracking progress through a bucket
in the UDP table with one based on socket cookies. Remember the cookies
of unprocessed sockets from the last batch and use this list to
pick up where we left off or, in the case that the next socket
disappears between reads, find the first socket after that point that
still exists in the bucket and resume from there.
This approach guarantees that all sockets that existed when iteration
began and continue to exist throughout will be visited exactly once.
Sockets that are added to the table during iteration may or may not be
seen, but if they are they will be seen exactly once.
Initialize iter->st_bucket_done to true and iter->state.bucket to -1 to
ensure that on the first call to bpf_iter_udp_batch, the resume_bucket
case is not hit. It's not strictly accurate that we are resuming from
bucket zero when we create the first batch, and this avoids adding
special case logic for just that bucket.
Signed-off-by: Jordan Rife <[email protected]>
0 commit comments