Eric Dumazet <eduma...@google.com> wrote: > > + /* ... so wait for even xt_recseq on all cpus */ > > + for_each_possible_cpu(cpu) { > > + seqcount_t *s = &per_cpu(xt_recseq, cpu); > > + > > + while (raw_read_seqcount(s) & 1) > > + cpu_relax(); > > + > > + cond_resched(); > > + } > > It seems that we could also check : > > 1) If low order bit of sequence is 0 > > Or > > 2) the value has changed > for_each_possible_cpu(cpu) { > seqcount_t *s = &per_cpu(xt_recseq, cpu); > u32 seq = raw_read_seqcount(s) ; > > if (seq & 1) { > do { > cpu_relax(); > } while (seq == raw_read_seqcount(s)); >
Actually I first used for_each_possible_cpu(cpu) { seqcount_t *s = &per_cpu(xt_recseq, cpu); (void)__read_seqcount_begin(s); } but it looked confusing (not paired with a _retry function). I'll respin with a loop like your suggestion above. Thanks!