[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49816D39.9030705@cosmosbay.com>
Date: Thu, 29 Jan 2009 09:47:53 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: Stephen Hemminger <shemminger@...tta.com>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 4/5] netfilter: use sequence number synchronization for
counters
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@...tta.com>
>
>
> ---
> include/linux/netfilter/x_tables.h | 3 +++
> net/ipv4/netfilter/arp_tables.c | 24 +++++++++++++++++++-----
> net/ipv4/netfilter/ip_tables.c | 24 +++++++++++++++++++-----
> net/ipv6/netfilter/ip6_tables.c | 32 +++++++++++++++++++++++---------
> net/netfilter/x_tables.c | 11 +++++++++++
> 5 files changed, 75 insertions(+), 19 deletions(-)
> 4
> --- a/net/ipv4/netfilter/arp_tables.c 2009-01-28 21:24:39.223991934 -0800
> +++ b/net/ipv4/netfilter/arp_tables.c 2009-01-28 22:13:16.423490077 -0800
> @@ -230,6 +230,7 @@ unsigned int arpt_do_table(struct sk_buf
> void *table_base;
> const struct xt_table_info *private;
> struct xt_target_param tgpar;
> + seqcount_t *seq;
>
> if (!pskb_may_pull(skb, arp_hdr_len(skb->dev)))
> return NF_DROP;
> @@ -240,6 +241,7 @@ unsigned int arpt_do_table(struct sk_buf
> read_lock_bh(&table->lock);
> private = table->private;
> table_base = (void *)private->entries[smp_processor_id()];
> + seq = per_cpu_ptr(private->seq, smp_processor_id());
But, why not using a global seqcount_t, shared by all tables, no matter they
are arp_tables, ip_tables, ip6_tables ?
A global PER_CPU variable, not dynamically allocated, so that its
access can be faster (no indirection), and uses exactly 4 bytes per
possible cpu.
DEFINE_PER_CPU(seqcount_t, nf_seqcount);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists