From: Patrick McHardy <kaber@trash•net>
To: Eric Dumazet <dada1@cosmosbay•com>
Cc: Stephen Hemminger <shemminger@vyatta•com>,
David Miller <davem@davemloft•net>,
Rick Jones <rick.jones2@hp•com>,
"Paul E. McKenney" <paulmck@linux•vnet.ibm.com>,
netdev@vger•kernel.org, netfilter-devel@vger•kernel.org
Subject: Re: [RFT 3/3] iptables: lock free counters
Date: Mon, 09 Feb 2009 16:52:59 +0100 [thread overview]
Message-ID: <4990515B.3070409@trash.net> (raw)
In-Reply-To: <4989071E.5000803@cosmosbay.com>
Eric Dumazet wrote:
> Stephen Hemminger a écrit :
>> @@ -939,14 +973,30 @@ static struct xt_counters * alloc_counte
>> counters = vmalloc_node(countersize, numa_node_id());
>>
>> if (counters == NULL)
>> - return ERR_PTR(-ENOMEM);
>> + goto nomem;
>> +
>> + tmp = xt_alloc_table_info(private->size);
>> + if (!tmp)
>> + goto free_counters;
>> +
>
>> + xt_zero_table_entries(tmp);
> This is not correct. We must copy rules and zero counters on the copied stuff.
Indeed.
>> static int
>> do_add_counters(struct net *net, void __user *user, unsigned int len, int compat)
>> @@ -1393,13 +1422,14 @@ do_add_counters(struct net *net, void __
>> goto free;
>> }
>>
>> - write_lock_bh(&t->lock);
>> + mutex_lock(&t->lock);
>> private = t->private;
>> if (private->number != num_counters) {
>> ret = -EINVAL;
>> goto unlock_up_free;
>> }
>>
>> + preempt_disable();
>> i = 0;
>> /* Choose the copy that is on our node */
This isn't actually necessary, its merely an optimization. Since this
can take quite a while, it might be nicer not to disable preempt.
next prev parent reply other threads:[~2009-02-09 15:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090204001202.724266235@vyatta.com>
2009-02-04 1:40 ` [RFT 0/3] netfilter: lock free tables Rick Jones
[not found] ` <20090204001755.808036408@vyatta.com>
2009-02-04 3:10 ` [RFT 3/3] iptables: lock free counters Eric Dumazet
2009-02-09 15:52 ` Patrick McHardy [this message]
2009-02-09 17:14 ` Stephen Hemminger
2009-02-10 17:52 ` [RFC] iptables: lock free counters (v0.6) Stephen Hemminger
2009-02-10 22:14 ` Ranjit Manomohan
2009-02-10 22:20 ` Rick Jones
2009-02-09 15:58 ` [RFT 3/3] iptables: lock free counters Patrick McHardy
[not found] ` <20090204001755.549902016@vyatta.com>
2009-02-09 16:27 ` [RFT 1/3] netfilter: change elements in x_tables Patrick McHardy
[not found] ` <20090204001755.685385465@vyatta.com>
2009-02-09 15:37 ` [RFT 2/3] netfilter: remove unneeded initializations Patrick McHardy
2009-02-09 16:23 ` Stephen Hemminger
2009-02-09 16:25 ` Patrick McHardy
2009-02-09 16:24 ` [PATCH] ebtables: " Stephen Hemminger
2009-02-09 16:30 ` Patrick McHardy
2009-02-09 16:28 ` [RFT 2/3] netfilter: " Patrick McHardy
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=4990515B.3070409@trash.net \
--to=kaber@trash$(echo .)net \
--cc=dada1@cosmosbay$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=paulmck@linux$(echo .)vnet.ibm.com \
--cc=rick.jones2@hp$(echo .)com \
--cc=shemminger@vyatta$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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