> In the worst case, where vmalloc() fails and the batch does not > cover full bucket, say the batch size is 16 but the list length > is 256, if the iterator stops at sk15 and sk16 disappers, > sk17 ~ sk256 will be skipped in the next iteration. > > sk1 -> ... sk15 -> sk16 -> sk17 -> ... -> sk256 Ah yes, this is true. Thank you for clarifying, you bring up a good point. In case vmalloc() fails, the batch size can't cover the whole bucket in one go, and none of the saved cookies from last time are in the bucket, there's currently no great option. You'd need to do one of the following: 1) Start from the beginning of the list, assuming none of the sockets had been seen so far. This risks repeating sockets you've already seen, however. 2) Skip the rest of the sockets to avoid repeating sockets you've already seen. You might skip sockets that you didn't want to skip. I actually wonder if a third option might be better in this case though: 3) If vmalloc fails, propagate ENOMEM up to userspace and stop iteration instead of making the tradeoff of possibly repeating or skipping sockets. seq_read can already return ENOMEM in some cases, so IMO this feels more correct. WDYT? -Jordan