netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>,
	Patrick McHardy <kaber@trash.net>,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [RFT 3/4] netfilter: use sequence number synchronization for counters
Date: Wed, 28 Jan 2009 07:35:26 +0100	[thread overview]
Message-ID: <497FFCAE.70503@cosmosbay.com> (raw)
In-Reply-To: <20090127222837.4ea8b255@extreme>

Stephen Hemminger a écrit :
> On Wed, 28 Jan 2009 07:17:04 +0100
> Eric Dumazet <dada1@cosmosbay.com> wrote:
>
>   
>> 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>
>>>
>>>
>>>   
>>> --- a/net/ipv4/netfilter/ip_tables.c	2009-01-27 14:48:41.567879095 -0800
>>> +++ b/net/ipv4/netfilter/ip_tables.c	2009-01-27 15:45:05.766673246 -0800
>>> @@ -366,7 +366,9 @@ ipt_do_table(struct sk_buff *skb,
>>>  			if (IPT_MATCH_ITERATE(e, do_match, skb, &mtpar) != 0)
>>>  				goto no_match;
>>>  
>>> +			write_seqcount_begin(&e->seq);
>>>  			ADD_COUNTER(e->counters, ntohs(ip->tot_len), 1);
>>> +			write_seqcount_end(&e->seq);
>>>   
>>>       
>> Its not very good to do it like this, (one seqcount_t per rule per cpu)
>>     
>
> If we use one count per table, that solves it, but it becomes a hot
> spot, and on an active machine will never settle.
>
>   
One seqcount per table and per cpu.
Only one cpu (the owner) will need to change the seqcount (one increment 
when entering ipt_do_table(), one increment when leaving)

This location is only read by the thread doing the "iptables -L". We 
dont care it spends a few cycles, it's already a big cruncher.

I dont understand your concern, what do you mean by "never settle" ?

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-01-28  6:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 23:53 [RFT 0/4] Iptables rwlock elimination Stephen Hemminger
2009-01-27 23:53 ` [RFT 1/4] netfilter: change elements in x_tables Stephen Hemminger
2009-01-27 23:53 ` [RFT 2/4] netfilter: remove unneeded initializations Stephen Hemminger
2009-01-28  0:10   ` Alexey Dobriyan
2009-01-27 23:53 ` [RFT 3/4] netfilter: use sequence number synchronization for counters Stephen Hemminger
2009-01-28  6:17   ` Eric Dumazet
2009-01-28  6:28     ` Stephen Hemminger
2009-01-28  6:35       ` Eric Dumazet [this message]
2009-01-28 16:15         ` Patrick McHardy
2009-01-27 23:53 ` [RFT 4/4] netfilter: convert x_tables to use RCU Stephen Hemminger
2009-01-28  7:37   ` Paul E. McKenney

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=497FFCAE.70503@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).