Skip to contentSkip to conversation

per-cpu table information

DISCUSSION Swapnil Nagle 3 participants 5 messages Sep 9, 2004 – Sep 16, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi all,

Why is the table information (ipt_table_info to be specific) duplicated for each CPU in ipt_table? Is it required so that new rules can be added simultanously while the existing rules are processed ?

Regards,
Swapnil.

#1 lore raw
Quoted 5 lines · Swapnil Nagle

Hi all,

Why is the table information (ipt_table_info to be specific) duplicated for each CPU in ipt_table?

Because we don't need any locking and we don't have cache line ping-pong between the CPU's, if there is no shared data.

Quoted 2 lines

Regards,
Swapnil.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw
Quoted 2 lines · On Thu, 16 Sep 2004 00:36:02 +0200 Harald Welte <[email protected]> wrote:

Because we don't need any locking and we don't have cache line ping-pong between the CPU's, if there is no shared data.

In my opinion the disadvantages (both in code complexity and table update cost) far outweigh whatever speed gains you this obtains.

#3 lore raw
Quoted 8 lines · David S. Miller
Quoted 2 lines · On Thu, 16 Sep 2004 00:36:02 +0200 Harald Welte <[email protected]> wrote:

Because we don't need any locking and we don't have cache line ping-pong between the CPU's, if there is no shared data.

In my opinion the disadvantages (both in code complexity and table update cost) far outweigh whatever speed gains you this obtains.

Table update cost is mostly harmed by the atomic replacement of the whole table, not by one-time copying...

And iptables performance is bad enough, we don't need to make it any worse (we have per-rule counters that need to be written to!).

Anyway, pkttables will simply have a 'matchinfo/targinfo read only' policy (everybody who needs a writable memory needs to dynamically allocate and do his own locking), and not have per-rule countes anymore. This means the whole ruleset is read-only and we don't need any code replication.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#4 lore raw
Quoted 5 lines · On Thu, 16 Sep 2004 09:12:02 +0200 Harald Welte <[email protected]> wrote:

Anyway, pkttables will simply have a 'matchinfo/targinfo read only' policy (everybody who needs a writable memory needs to dynamically allocate and do his own locking), and not have per-rule countes anymore. This means the whole ruleset is read-only and we don't need any code replication.

Sounds great.