Query abt updation of byte/pkt counters with multiple processors
Hi all,
A cursory glance at the ip_tables source shows that a separate copy of the set of rules is made for every cpu.
Does this include the byte and packet counters as well?
If yes, how is the updation of the counters done upon receival of pkts, so that we have the same value in all the sets?
Regards,
Vijaya Chandra Vupputuri,
Tachyon Technologies.
Quoted 3 lines · Vijaya Chandra Vupputuri
A cursory glance at the
ip_tablessource shows that a separate copy of the set of rules is made for every cpu.
Does this include the byte and packet counters as well?
Yes.
The reason to this is to avoid CPU cache ping-pong effect due to both CPUs writing in the same memory area.
Quoted 2 lines
If yes, how is the updation of the counters done upon receival of pkts, so that we have the same value in all the sets?
It doesn't.
At best it sums the counters of the CPUs when you read them with iptables, but I am not entirely sure this is done.
What I do remember and related to this is that the limit match is defenitely running per CPU, and when you read the status using iptables only the limit couters of the dirst CPU is reported.
Regards
Henrik
Quoted 11 lines · Henrik Nordstrom
Quoted 3 lines · Vijaya Chandra Vupputuri
A cursory glance at the
ip_tablessource shows that a separate copy of the set of rules is made for every cpu.
Does this include the byte and packet counters as well?Yes.
The reason to this is to avoid CPU cache ping-pong effect due to both CPUs writing in the same memory area.
Quoted 7 lines
Quoted 2 lines
If yes, how is the updation of the counters done upon receival of pkts, so that we have the same value in all the sets?
It doesn't.
At best it sums the counters of the CPUs when you read them with iptables, but I am not entirely sure this is done.
in ip_tables.c, get_counters() function this is done. It sums for all CPU's in the system.
Quoted 9 lines
What I do remember and related to this is that the limit match is defenitely running per CPU, and when you read the status using iptables only the limit couters of the dirst CPU is reported.
Regards
Henrik