On 07/07, Jordan Rife wrote: > TCP socket iterators use iter->offset to track progress through a > bucket, which is a measure of the number of matching sockets from the > current bucket that have been seen or processed by the iterator. On > subsequent iterations, if the current bucket has unprocessed items, we > skip at least iter->offset matching items in the bucket before adding > any remaining items to the next batch. However, iter->offset isn't > always an accurate measure of "things already seen" when the underlying > bucket changes between reads, which can lead to repeated or skipped > sockets. Instead, this series remembers the cookies of the sockets we > haven't seen yet in the current bucket and resumes from the first cookie > in that list that we can find on the next iteration. > > This is a continuation of the work started in [1]. This series largely > replicates the patterns applied to UDP socket iterators, applying them > instead to TCP socket iterators. > > CHANGES > ======= > v3 -> v4: > * Drop braces around sk_nulls_for_each_from in patch five ("bpf: tcp: > Avoid socket skips and repeats during iteration") (Stanislav). > * Add a break after the TCP_SEQ_STATE_ESTABLISHED case in patch five > (Stanislav). > * Add an `if (sock_type == SOCK_STREAM)` check before assigning > TCP_LISTEN to skel->rodata->ss in patch eight ("selftests/bpf: Allow > for iteration over multiple states") to more clearly express the > intent that the option is only consumed for SOCK_STREAM tests > (Stanislav). > * Move the `i = 0` assignment into the for loop in patch ten > ("selftests/bpf: Create established sockets in socket iterator > tests") (Stanislav). LGTM, thank you! Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>