Stephen Hemminger a écrit : > Change how synchronization is done on the iptables counters. Use seqcount > wrapper instead of depending on reader/writer lock. > > Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx> > > --- a/net/netfilter/x_tables.c 2009-01-29 11:08:38.747070716 -0800 > +++ b/net/netfilter/x_tables.c 2009-01-29 11:10:03.595571234 -0800 > @@ -577,6 +577,34 @@ int xt_compat_target_to_user(struct xt_e > EXPORT_SYMBOL_GPL(xt_compat_target_to_user); > #endif > > +static DEFINE_PER_CPU(seqcount_t, xt_counter_sequence); > + > +void xt_fetch_counter(struct xt_counters *v, int cpu, > + const struct xt_counters *c) > +{ > + seqcount_t *seq = &per_cpu(xt_counter_sequence, cpu); > + unsigned start; > + > + do { > + start = read_seqcount_begin(seq); > + *v = *c; > + } while (read_seqcount_retry(seq, start)); > +} > +EXPORT_SYMBOL_GPL(xt_fetch_counter); > + > +void xt_incr_counter(struct xt_counters *c, unsigned b, unsigned p) You really want an inline xt_incr_counter() function here to speedup ipt_do_table() I agree xt_fetch_counter() is not time critical and can be outlined. > +{ > + seqcount_t *seq = &__get_cpu_var(xt_counter_sequence); > + > + write_seqcount_begin(seq); > + c->pcnt += p; > + c->bcnt += b; > + write_seqcount_end(seq); > + > +} > +EXPORT_SYMBOL_GPL(xt_incr_counter); > + > + -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html