[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171011134530.GA26835@breakpoint.cc>
Date: Wed, 11 Oct 2017 15:45:30 +0200
From: Florian Westphal <fw@...len.de>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Florian Westphal <fw@...len.de>, netdev <netdev@...r.kernel.org>,
Dan Williams <dcbw@...hat.com>
Subject: Re: [PATCH v2 nf-next 1/2] netfilter: x_tables: make
xt_replace_table wait until old rules are not used anymore
Eric Dumazet <edumazet@...gle.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!
Powered by blists - more mailing lists