From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v2 -next 1/2] netfilter: iptables: separate counters from iptables rules
Date: Thu, 28 May 2015 23:45:40 +0200 [thread overview]
Message-ID: <20150528214540.GF23992@breakpoint.cc> (raw)
In-Reply-To: <1432848817.7456.30.camel@edumazet-glaptop2.roam.corp.google.com>
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > +
> > + /* pointer to array of counters, one per CPU
> > + * each rule maps 1:1 to an entry in the percpu counter array.
> > + */
> > + struct xt_counters **counters;
> > +
>
> You could avoid using this array, if you use alloc_percpu(struct
> xt_counter) per counter.
I used this since it fits with the jumpstack allocation that we already
have.
Is there an inherent advantage to alloc_percpu?
[ I'm asking to see if it makes sense to convert jump stack too ].
> In the rules, instead of storing the index of each counter, store the
> percpu address.
-v
How? What address? You mean relative offset to counter start?
> This would avoid yet another indirection in iptables.
I don't see how I can avoid it.
when rule x matches, I need to increment the corresponding counter
for that rule.
But there is no 1:1 mapping of addresses, and I found no way to infer
the correct counter address to use for the rule just by looking at
ipt_entry address.
Thats why the entry stores the 'counter' index: to find the counter to
increment based on current cpu counter array and the rule number.
> And it would be nice avoiding this stuff on non SMP kernels maybe ?
Hmm. Will have to think about this to minimize ifdef kludgery.
But, yes, I agree. Will fix it in v3.
Thanks Eric.
next prev parent reply other threads:[~2015-05-28 21:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 20:51 [PATCH v2 -next 1/2] netfilter: iptables: separate counters from iptables rules Florian Westphal
2015-05-28 20:51 ` [PATCH v2 -next 2/2] netfilter: store rules per NUMA node instead of per cpu Florian Westphal
2015-05-28 21:38 ` Eric Dumazet
2015-05-28 21:52 ` Florian Westphal
2015-05-28 22:04 ` Eric Dumazet
2015-05-29 9:41 ` Florian Westphal
2015-05-28 21:33 ` [PATCH v2 -next 1/2] netfilter: iptables: separate counters from iptables rules Eric Dumazet
2015-05-28 21:45 ` Florian Westphal [this message]
2015-05-28 21:54 ` Eric Dumazet
2015-05-29 10:05 ` Florian Westphal
2015-05-29 10:32 ` Eric Dumazet
2015-05-29 11:32 ` Patrick Schaaf
2015-06-05 12:28 ` Florian Westphal
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=20150528214540.GF23992@breakpoint.cc \
--to=fw@strlen.de \
--cc=eric.dumazet@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/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).