From: Eric Dumazet <dada1@cosmosbay.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 4/5] netfilter: use sequence number synchronization for counters
Date: Thu, 29 Jan 2009 09:47:53 +0100 [thread overview]
Message-ID: <49816D39.9030705@cosmosbay.com> (raw)
In-Reply-To: <20090129062549.234454895@vyatta.com>
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@vyatta.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);
next prev parent reply other threads:[~2009-01-29 8:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-29 6:25 [PATCH 0/5] iptables lockless receive (v0.3) Stephen Hemminger
2009-01-29 6:25 ` [PATCH 1/5] netfilter: change elements in x_tables Stephen Hemminger
2009-01-29 6:25 ` [PATCH 2/5] netfilter: remove unneeded initializations Stephen Hemminger
2009-01-29 6:25 ` [PATCH 3/5] ebtables: " Stephen Hemminger
2009-01-29 6:25 ` [PATCH 4/5] netfilter: use sequence number synchronization for counters Stephen Hemminger
2009-01-29 8:47 ` Eric Dumazet [this message]
2009-01-29 6:25 ` [PATCH 5/5] netfilter: convert x_tables to use RCU Stephen Hemminger
2009-01-29 23:04 ` Eric Dumazet
2009-01-29 23:16 ` Stephen Hemminger
2009-01-30 6:53 ` Eric Dumazet
2009-01-30 7:02 ` Eric Dumazet
2009-01-30 7:05 ` Eric Dumazet
2009-01-29 8:07 ` [PATCH 0/5] iptables lockless receive (v0.3) Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49816D39.9030705@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.