ucc_geth: nf_conntrack: table full, dropping packet.
Subsystems (3)
doing a "ping -f -l 3" on my host towards my board on linus tree as of Friday results in lots of:nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.
for ucc_geth on a MPC832x.
This really looks strange to me, ideas?
Jocke
Quoted 10 lines · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as of Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.
Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?
What does /proc/net/netfilter/nf_conntrack show?
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 14 lines
Quoted 12 lines · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as of
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.
Quoted 4 lines
Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?
There is no /proc/net/netfilter/nf_conntrack. There is a /proc/net/nf_conntrack though and it is empty. If I telnet to the board I see:
ipv4 2 tcp 6 431990 ESTABLISHED src=192.168.1.15 dst=192.168.1.17
sport=56445 dport=23 src=192.168.1.17 dst=192.168.1.15 sport=23 dport=56445 [ASSURED] use=1
ipv4 2 udp 17 7 src=192.168.1.228 dst=192.168.1.255 sport=138
dport=138 [UNREPLIED] src=192.168.1.255 dst=192.168.1.228 sport=138 dport=138 use=1
ipv4 2 udp 17 20 src=127.0.0.1 dst=127.0.0.1 sport=34261 dport=53
[UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=34261 use=1
ipv4 2 udp 17 2 src=192.168.1.199 dst=192.168.1.255 sport=138
dport=138 [UNREPLIED] src=192.168.1.255 dst=192.168.1.199 sport=138 dport=138 use=1
ipv4 2 udp 17 20 src=127.0.0.1 dst=127.0.0.1 sport=40417 dport=53
[UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40417 use=1
Jocke
Quoted 14 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 13 lines
Quoted 12 lines · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as of
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:
That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess would be the ucc_geth driver.
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 4 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as
of
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?
Quoted 7 lines
Quoted 3 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess would be the
ucc_gethdriver.
hmm, I cannot see what in the ucc_geth driver is possibly "leaking". One thing
I do notice is that the board becomes almost unresponsive during the ping flood.
Perhaps it is building up a backlog of conntracks during the ping flood?
Jocke
A message that is not in the archive (sent off-list or not yet received): OF387EC803.F810F72A-ONC1257582.00468C6E-C1257582.00475783@LocalDomain
Joakim Tjernlund/Transmode wrote on 23/03/2009 13:59:15:
Quoted 6 lines
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 4 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree
as of
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
What does
/proc/net/netfilter/nf_conntrackshow?There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 3 lines
Quoted 1 line
be the
ucc_gethdriver.hmm, I cannot see what in the
ucc_gethdriver is possibly "leaking". One
thing
Quoted 1 line
I do notice is that the board becomes almost unresponsive during the
ping flood.
Quoted 3 lines
Perhaps it is building up a backlog of conntracks during the ping flood?
Jocke
next hmm, ethtool -S eth0 shows:
...
rx-mismatch-drop-frames: 13
...
13 matches the number of lost frames after I stop the ping flood.
The MPC832x manual says this(if i found the correct counter):
REBASE+2C MisMatchDrop 32 Counts number of frames dropped due to MAC filtering process, (e.g.
Address Mismatch, Type mismatch) and that would
otherwise
considered good frame that would be transferred
to upper layers
Why would a ping flood result in Address Mismatch or Type mismatch?
Leo?
Jocke
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as
of
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?
Quoted 8 lines
Quoted 3 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess would be the
ucc_gethdriver.
Mucking around with the ucc_geth driver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel thread has
stopped
scanning the FS
Then the "nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?
Jocke
Quoted 19 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 8 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess would be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel thread has
stopped
scanning the FS
Quoted 2 lines
Then the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?
No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the sk_buff slabs in /proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 10 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel thread
has
Quoted 11 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in/proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache 0 0 352 11 1 : tunables 54 27 0
: slabdata 0 0 0
skbuff_head_cache 20 20 192 20 1 : tunables 120 60 0
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120 60 0 : slabdata 13 13 0
nf_conntrack 10 19 208 19 1 : tunables 120 60 0
: slabdata 1 1 0
During ping:
skbuff_fclone_cache 0 0 352 11 1 : tunables 54 27 0
: slabdata 0 0 0
skbuff_head_cache 40 40 192 20 1 : tunables 120 60 0
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120 60 0
: slabdata 151 151 0
nf_conntrack 5111 5111 208 19 1 : tunables 120 60 0
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed and builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to wait a bit longer.
Jocke
Quoted 53 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel threadhas
Quoted 10 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in/proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 27 0
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 120 60 0: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120 60 0 : slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 120 60 0
: slabdata 1 1 0During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 27 0
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 120 60 0
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120 60 0
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 120 60 0
: slabdata 269 269 0
Quoted 5 lines
This feels more like the freeing of conntrack objects are delayed and builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to wait a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep CONFIG_SMP .config
You could change qhimark from 10000 to 1000 in kernel/rcuclassic.c (line 80) as a workaround. It should force a quiescent state after 1000 freed conntracks.
Eric Dumazet <[email protected]> wrote on 24/03/2009 10:12:53:
Quoted 13 lines
Quoted 11 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel
thread
Quoted 12 lines
Quoted 12 lines
has
Quoted 10 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in/proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.
Quoted 4 lines
Quoted 4 lines
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 27
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 120 60
0
Quoted 2 lines
Quoted 2 lines
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120 60
0
Quoted 2 lines
Quoted 2 lines
: slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 120 60
0
Quoted 4 lines
Quoted 4 lines
: slabdata 1 1 0
During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 27
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 120 60
0
Quoted 2 lines
Quoted 2 lines
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120 60
0
Quoted 2 lines
Quoted 2 lines
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 120 60
0
Quoted 6 lines
Quoted 6 lines
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed and builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to
wait
Quoted 8 lines
Quoted 1 line
a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep RCU .config
# RCU SubsystemCONFIG_CLASSIC_RCU=y
# CONFIG_TREE_RCU is not set
# CONFIG_PREEMPT_RCU is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_PREEMPT_RCU_TRACE is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
Quoted 1 line
grep
CONFIG_SMP.config
grep CONFIG_SMP .config
# CONFIG_SMP is not set
Quoted 2 lines
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c(line
80)
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to stress it pretty
hard before I saw handful "nf_conntrack: table full, dropping packet"
RCU is not my cup of tea, do you have any ideas were to look?
Jocke
PATCH 1/1 conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 91 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 10:12:53:
Quoted 12 lines
Quoted 11 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernelthread
Quoted 11 lines
Quoted 11 lines
has
Quoted 10 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in/proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.Quoted 4 lines
Quoted 4 lines
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 270
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 120 600
Quoted 4 lines
Quoted 4 lines
: slabdata 1 1 0
During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 270
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 120 600
Quoted 6 lines
Quoted 6 lines
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed and builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to
wait
Quoted 7 lines
Quoted 1 line
a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep RCU .config
# RCU SubsystemCONFIG_CLASSIC_RCU=y
#CONFIG_TREE_RCUis not set
#CONFIG_PREEMPT_RCUis not set
#CONFIG_TREE_RCU_TRACEis not set
#CONFIG_PREEMPT_RCU_TRACEis not set
#CONFIG_RCU_TORTURE_TESTis not set
#CONFIG_RCU_CPU_STALL_DETECTORis not setQuoted 1 line
grep
CONFIG_SMP.configgrep
CONFIG_SMP.config
#CONFIG_SMPis not setQuoted 1 line
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c(line80)
Quoted 8 lines
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to stress it pretty
hard before I saw handful "nf_conntrack: table full, dropping packet"RCU is not my cup of tea, do you have any ideas were to look?
In a stress situation, you feed more deleted conntracks to call_rcu() than the blimit (10 real freeing per RCU softirq invocation).
So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued items, instead of a small batch of 10
To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example)
Probably should be done to reduce some spikes in RCU code when freeing whole 10000 elements...
OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) change net/netfilter/nf_conntrack_core.c to decrement net->ct.count in nf_conntrack_free() instead of callback.
[PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in nf_conntrack_free(), not in the RCU callback.
net/netfilter/nf_conntrack_core.c +3 -2
@@ -516,16 +516,17 @@ EXPORT_SYMBOL_GPL(nf_conntrack_alloc);static void nf_conntrack_free_rcu (struct rcu_head *head) { struct nf_conn *ct = container_of(head, struct nf_conn, rcu); -struct net *net =nf_ct_net (ct);nf_ct_ext_free (ct);kmem_cache_free (nf_conntrack_cachep, ct); -atomic_dec (&net->ct.count); }void nf_conntrack_free (struct nf_conn *ct) { +struct net *net =nf_ct_net (ct); +nf_ct_ext_destroy (ct); +atomic_dec (&net->ct.count);call_rcu (&ct->rcu, nf_conntrack_free_rcu); }EXPORT_SYMBOL_GPL (nf_conntrack_free);
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 147 lines · Eric Dumazet
Quoted 91 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 10:12:53:
Quoted 12 lines
Quoted 11 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernelthread
Quoted 11 lines
Quoted 11 lines
has
Quoted 10 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in/proc/slabinfo. If that *doesn't* show any signs of a leak, please run "conntrack -E" to capture the conntrack events before the "table full" message appears and post the output.Quoted 4 lines
Quoted 4 lines
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 270
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 120 600
Quoted 4 lines
Quoted 4 lines
: slabdata 1 1 0
During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54 270
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120 600
Quoted 2 lines
Quoted 2 lines
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 120 600
Quoted 6 lines
Quoted 6 lines
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed and builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to
wait
Quoted 7 lines
Quoted 1 line
a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep RCU .config
# RCU SubsystemCONFIG_CLASSIC_RCU=y
#CONFIG_TREE_RCUis not set
#CONFIG_PREEMPT_RCUis not set
#CONFIG_TREE_RCU_TRACEis not set
#CONFIG_PREEMPT_RCU_TRACEis not set
#CONFIG_RCU_TORTURE_TESTis not set
#CONFIG_RCU_CPU_STALL_DETECTORis not setQuoted 1 line
grep
CONFIG_SMP.configgrep
CONFIG_SMP.config
#CONFIG_SMPis not setQuoted 1 line
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c(line80)
Quoted 8 lines
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to stress it pretty
hard before I saw handful "nf_conntrack: table full, dropping packet"RCU is not my cup of tea, do you have any ideas were to look?
In a stress situation, you feed more deleted conntracks to
call_rcu()than the blimit (10 real freeing per RCU softirq invocation).So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued items, instead of a small batch of 10
To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example)
Probably should be done to reduce some spikes in RCU code when freeing whole 10000 elements...
OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrementnet->ct.countinnf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.Signed-off-by Eric Dumazet <[email protected]>net/netfilter/nf_conntrack_core.c +0
-2@@ -516,16 +516,17 @@ EXPORT_SYMBOL_GPL(nf_conntrack_alloc);static void nf_conntrack_free_rcu (struct rcu_head *head) { struct nf_conn *ct = container_of(head, struct nf_conn, rcu); -struct net *net =nf_ct_net (ct);nf_ct_ext_free (ct);kmem_cache_free (nf_conntrack_cachep, ct); -atomic_dec (&net->ct.count); }
net/netfilter/nf_conntrack_core.c EXPORT_SYMBOL_GPL(nf_conntrack_alloc); · line 532
Quoted 10 lines
net/netfilter/nf_conntrack_core.c +3
-0void nf_conntrack_free (struct nf_conn *ct) { +struct net *net =nf_ct_net (ct); +nf_ct_ext_destroy (ct); +atomic_dec (&net->ct.count);call_rcu (&ct->rcu, nf_conntrack_free_rcu); }EXPORT_SYMBOL_GPL (nf_conntrack_free);
I forgot to say this is what we do for 'struct file' freeing as well. We decrement nr_files in file_free(), not in file_free_rcu()
static inline void file_free_rcu(struct rcu_head *head)
{
struct file *f = container_of(head, struct file, f_u.fu_rcuhead);
put_cred(f->f_cred);
kmem_cache_free(filp_cachep, f);
}static inline void file_free(struct file *f)
{
percpu_counter_dec(&nr_files); <<<< HERE >>>>
file_check_state(f);
call_rcu(&f->f_u.fu_rcuhead, file_free_rcu);
}Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 47 lines · Eric Dumazet
Quoted 47 lines
In a stress situation, you feed more deleted conntracks to
call_rcu()than the blimit (10 real freeing per RCU softirq invocation).So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued items, instead of a small batch of 10
To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example)
Probably should be done to reduce some spikes in RCU code when freeing whole 10000 elements...
OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrementnet->ct.countinnf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.Signed-off-by Eric Dumazet <[email protected]>net/netfilter/nf_conntrack_core.c +0
-2@@ -516,16 +516,17 @@ EXPORT_SYMBOL_GPL(nf_conntrack_alloc);static void nf_conntrack_free_rcu (struct rcu_head *head) { struct nf_conn *ct = container_of(head, struct nf_conn, rcu); -struct net *net =nf_ct_net (ct);nf_ct_ext_free (ct);kmem_cache_free (nf_conntrack_cachep, ct); -atomic_dec (&net->ct.count); }
Quoted 12 lines
net/netfilter/nf_conntrack_core.c EXPORT_SYMBOL_GPL(nf_conntrack_alloc); · line 532
Quoted 9 lines
net/netfilter/nf_conntrack_core.c +3
-0void nf_conntrack_free (struct nf_conn *ct) { +struct net *net =nf_ct_net (ct); +nf_ct_ext_destroy (ct); +atomic_dec (&net->ct.count);call_rcu (&ct->rcu, nf_conntrack_free_rcu); }EXPORT_SYMBOL_GPL (nf_conntrack_free);I forgot to say this is what we do for 'struct file' freeing as well. We decrement
nr_filesinfile_free(), not infile_free_rcu()
While temporarily exceeding the limit by up to 10000 entries is quite a lot, I guess the important thing is that it can't grow unbounded, so I think this patch is fine.
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 70 lines · Patrick McHardy
Quoted 55 lines · Eric Dumazet
Quoted 55 lines
In a stress situation, you feed more deleted conntracks to
call_rcu()than
the blimit (10 real freeing per RCU softirq invocation).
So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.Only when hitting 10000, RCU enters a special mode to free all queued items, instead
of a small batch of 10To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example)
Probably should be done to reduce some spikes in RCU code when
freeing
whole 10000 elements...
OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrementnet->ct.countinnf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might
accumulate about 10.000 elements per CPU in its internal queues. To get accurate
conntrack counts (at the expense of slightly more RAM used), we might consider
conntrack counter not taking into account "about to be freed elements, waiting
in RCU queues". We thus decrement it innf_conntrack_free(), not in the RCU
callback.Signed-off-by Eric Dumazet <[email protected]>net/netfilter/nf_conntrack_core.c +0
-2@@ -516,16 +516,17 @@ EXPORT_SYMBOL_GPL(nf_conntrack_alloc);static void nf_conntrack_free_rcu (struct rcu_head *head) { struct nf_conn *ct = container_of(head, struct nf_conn, rcu); -struct net *net =nf_ct_net (ct);nf_ct_ext_free (ct);kmem_cache_free (nf_conntrack_cachep, ct); -atomic_dec (&net->ct.count); }Quoted 12 lines
net/netfilter/nf_conntrack_core.c EXPORT_SYMBOL_GPL(nf_conntrack_alloc); · line 532
Quoted 9 lines
net/netfilter/nf_conntrack_core.c +3
-0void nf_conntrack_free (struct nf_conn *ct) { +struct net *net =nf_ct_net (ct); +nf_ct_ext_destroy (ct); +atomic_dec (&net->ct.count);call_rcu (&ct->rcu, nf_conntrack_free_rcu); }EXPORT_SYMBOL_GPL (nf_conntrack_free);I forgot to say this is what we do for 'struct file' freeing as well. We decrement
nr_filesinfile_free(), not infile_free_rcu()
Quoted 5 lines
While temporarily exceeding the limit by up to 10000 entries is quite a lot, I guess the important thing is that it can't grow unbounded, so I think this patch is fine.
Maybe we could use SLAB_DESTROY_BY_RCU thing and no more call_rcu() queueing problem. That would better use CPU caches as well...
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 11 lines · Eric Dumazet
Quoted 7 lines · Patrick McHardy
Quoted 2 lines
I forgot to say this is what we do for 'struct file' freeing as well. We decrement
nr_filesinfile_free(), not infile_free_rcu()While temporarily exceeding the limit by up to 10000 entries is quite a lot, I guess the important thing is that it can't grow unbounded, so I think this patch is fine.
Maybe we could use
SLAB_DESTROY_BY_RCUthing and no morecall_rcu()queueing problem. That would better use CPU caches as well...
I'm not sure I understand the rules correctly, but we'd still have to wait for the grace period before an object can be reused, no?
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 11 lines · Patrick McHardy
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Patrick McHardy
Quoted 3 lines
I forgot to say this is what we do for 'struct file' freeing as well. We
decrementnr_filesinfile_free(), not infile_free_rcu()While temporarily exceeding the limit by up to 10000 entries is quite a lot, I guess the important thing is that it can't grow unbounded, so I think this patch is fine.
Quoted 7 lines
Quoted 3 lines
Maybe we could use
SLAB_DESTROY_BY_RCUthing and no morecall_rcu()queueing
problem. That would better use CPU caches as well...I'm not sure I understand the rules correctly, but we'd still have to wait for the grace period before an object can be reused, no?
No we dont have to, but we must do additionnal checks after getting a reference on object found on lookup.
(We must re-check the keys used during search)
This re-check is not very expensive since everything is hot in cpu cache.
Check Documentation/RCU/rculist_nulls.txt for some documentation.
1) Lookup algo
--------------
rcu_read_lock()
begin:
obj = lockless_lookup(key);
if (obj) {
if (!try_get_ref(obj)) // might fail for free objects
goto begin;
/*
* Because a writer could delete object, and a writer could
* reuse these object before the RCU grace period, we
* must check key after geting the reference on object
*/
if (obj->key != key) { // not the object we expected
put_ref(obj);
goto begin; }
}rcu_read_unlock();
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 18 lines · Patrick McHardy
Quoted 17 lines · Eric Dumazet
Quoted 16 lines · Eric Dumazet
Quoted 8 lines · Patrick McHardy
Quoted 3 lines · Eric Dumazet
Maybe we could use
SLAB_DESTROY_BY_RCUthing and no morecall_rcu()queueing
problem. That would better use CPU caches as well...I'm not sure I understand the rules correctly, but we'd still have to wait for the grace period before an object can be reused, no?
No we dont have to, but we must do additionnal checks after getting a reference on object found on lookup.
(We must re-check the keys used during search)This re-check is not very expensive since everything is hot in cpu cache.
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
Check
Documentation/RCU/rculist_nulls.txtfor some documentation.Patrick, I can work on this if you want, since this stuff is fresh in my head, let me know if you already challenged it or not :)
I'm still looking at the details, if you want to take care of this, that would be great .)
I have a litle problem on __nf_conntrack_find() being exported.
Problem is that with SLAB_DESTROY_BY_RCU we must take a reference on object to recheck it. So ideally only nf_conntrack_find_get() should be used, or callers of __nf_conntrack_find() should lock nf_conntrack_lock (as properly done for example in net/netfilter/nf_conntrack_netlink.c, line 1292)
Here is preliminary patch for review (not tested at all, its 4h50 am here :) )
Could you help me, by checking __nf_conntrack_find() use in net/netfilter/xt_connlimit.c ? and line 1246 of net/netfilter/nf_conntrack_netlink.c
This part is a litle bit gray for me. :)
Thank you
(Patch against nf-next-2.6 tree of course)
Eric
include/net/netfilter/nf_conntrack.h | 14 - include/net/netfilter/nf_conntrack_tuple.h | 6 include/net/netns/conntrack.h | 5 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 16 - net/ipv4/netfilter/nf_nat_core.c | 2 net/netfilter/nf_conntrack_core.c | 121 +++++----- net/netfilter/nf_conntrack_expect.c | 2 net/netfilter/nf_conntrack_helper.c | 7 net/netfilter/nf_conntrack_netlink.c | 7 net/netfilter/nf_conntrack_standalone.c | 16 - 10 files changed, 109 insertions(+), 87 deletions(-)
include/net/netfilter/nf_conntrack.h +8 -6
@@ -91,8 +91,7 @@ struct nf_conn_help {#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> #include <net/netfilter/ipv6/nf_conntrack_ipv6.h> -struct nf_conn -{ +struct nf_conn {/* Usage count in here is 1 for hash table/destruct timer, 1 per skb, plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn#ifdef CONFIG_NET_NS struct net *ct_net;#endif -struct rcu_head rcu; }; static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)extern int nf_ct_l3proto_try_module_get (unsigned short l3proto);extern void nf_ct_l3proto_module_put (unsigned short l3proto); -extern struct hlist_head *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced); -extern void nf_ct_free_hashtable (struct hlist_head *hash,int vmalloced, -unsigned int size); +/* +* Allocate a hashtable of hlist_head (if nulls == 0), +* or hlist_nulls_head (if nulls == 1) +*/ +extern void *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced,int nulls); + +extern void nf_ct_free_hashtable (void *hash,int vmalloced,unsigned int size);extern struct nf_conntrack_tuple_hash *__nf_conntrack_find (struct net *net,const struct nf_conntrack_tuple *tuple);
include/net/netfilter/nf_conntrack_tuple.h +3 -3
@@ -12,6 +12,7 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> +#include <linux/list_nulls.h> /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) ((enum ip_conntrack_dir )(h)->tuple.dst.dir) /* Connections have two entries in the hash table: one for each way */ -struct nf_conntrack_tuple_hash -{ -struct hlist_node hnode; +struct nf_conntrack_tuple_hash { +struct hlist_nulls_node hnnode;struct nf_conntrack_tuple tuple; };
include/net/netns/conntrack.h +3 -2
@@ -2,6 +2,7 @@#define __NETNS_CONNTRACK_H#include <linux/list.h> +#include <linux/list_nulls.h> #include <asm/atomic.h> struct ctl_table_header ;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;struct netns_ct {atomic_t count;unsigned int expect_count; -struct hlist_head *hash; +struct hlist_nulls_head *hash;struct hlist_head *expect_hash; -struct hlist_head unconfirmed; +struct hlist_nulls_head unconfirmed;struct ip_conntrack_stat *stat;#ifdef CONFIG_NF_CONNTRACK_EVENTS struct nf_conntrack_ecache *ecache;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +8 -8
@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);
@@ -56,9 +56,9 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head)while (pos && (head =ct_get_next (seq, head)))
net/ipv4/netfilter/nf_nat_core.c +1 -1
@@ -679,7 +679,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,static int __net_init nf_nat_net_init (struct net *net) { net->ipv4.nat_bysource =nf_ct_alloc_hashtable (&nf_nat_htable_size, - &net->ipv4.nat_vmalloced); + &net->ipv4.nat_vmalloced,0 );if (!net->ipv4.nat_bysource)return -ENOMEM ;return 0 ;
net/netfilter/nf_conntrack_core.c +69 -52
311 lines not on this page · raw message
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -604,7 +604,7 @@ int nf_conntrack_expect_init(struct net *net) net->ct.expect_count =0 ; net->ct.expect_hash =nf_ct_alloc_hashtable (&nf_ct_expect_hsize, - &net->ct.expect_vmalloc); + &net->ct.expect_vmalloc,0 );if (net->ct.expect_hash ==NULL ) goto err1;
net/netfilter/nf_conntrack_helper.c +4 -3
@@ -158,6 +158,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,struct nf_conntrack_tuple_hash *h;struct nf_conntrack_expect *exp;const struct hlist_node *n, *next; +const struct hlist_nulls_node *nn;unsigned int i;/* Get rid of expectations */
@@ -174,10 +175,10 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me, }/* Get rid of expecteds, set helpers to NULL. */ -hlist_for_each_entry (h, n, &net->ct.unconfirmed, hnode) +hlist_for_each_entry (h, nn, &net->ct.unconfirmed, hnnode)unhelp (h, me);for (i =0 ; i < nf_conntrack_htable_size; i++) { -hlist_for_each_entry (h, n, &net->ct.hash[i], hnode) +hlist_nulls_for_each_entry (h, nn, &net->ct.hash[i], hnnode)unhelp (h, me); } }
@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );if (!nf_ct_helper_hash)return -ENOMEM ;
net/netfilter/nf_conntrack_netlink.c +4 -3
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/rculist.h> +#include <linux/rculist_nulls.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/skbuff.h>
@@ -536,7 +537,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) {struct nf_conn *ct, *last;struct nf_conntrack_tuple_hash *h; -struct hlist_node *n; +struct hlist_nulls_node *n;struct nfgenmsg *nfmsg =NLMSG_DATA (cb->nlh);u_int8_t l3proto = nfmsg->nfgen_family;
@@ -544,8 +545,8 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) last = (struct nf_conn *)cb->args[1 ];for (; cb->args[0 ] < nf_conntrack_htable_size; cb->args[0 ]++) { restart: -hlist_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], - hnode) { +hlist_nulls_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], + hnnode) {if (NF_CT_DIRECTION (h) !=IP_CT_DIR_ORIGINAL )continue ; ct =nf_ct_tuplehash_to_ctrack (h);
net/netfilter/nf_conntrack_standalone.c +8 -8
@@ -44,30 +44,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);
@@ -75,9 +75,9 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head)while (pos && (head =ct_get_next (seq, head)))
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 7 lines · Eric Dumazet
I have a litle problem on
__nf_conntrack_find()being exported.Problem is that with
SLAB_DESTROY_BY_RCUwe must take a reference on object to recheck it. So ideally onlynf_conntrack_find_get()should be used, or callers of__nf_conntrack_find()should locknf_conntrack_lock(as properly done for example innet/netfilter/nf_conntrack_netlink.c, line 1292)
Quoted 6 lines
Here is preliminary patch for review (not tested at all, its 4h50 am here :) )
Could you help me, by checking
__nf_conntrack_find()use innet/netfilter/xt_connlimit.c? and line 1246 ofnet/netfilter/nf_conntrack_netlink.cThis part is a litle bit gray for me. :)
In case of xt_connlimit, it seems fine to just take a reference. In case of ctnetlink, keeping the unreferenced lookup under the lock seems fine. We unfortunately have to export some internals like nf_conntrack lock for ctnetlink anyways, so I don't think it would be worth to change it to take references and unexport the lookup function.
Quoted 26 lines
net/netfilter/nf_conntrack_core.c +10
-2+/* +* Warning : +* - Caller must take a reference on returned object +* and recheck nf_ct_tuple_equal(tuple, &h->tuple) +* OR +* - Caller must lock nf_conntrack_lock before calling this function +*/ struct nf_conntrack_tuple_hash *__nf_conntrack_find (struct net *net,const struct nf_conntrack_tuple *tuple) {struct nf_conntrack_tuple_hash *h; -struct hlist_node *n; +struct hlist_nulls_node *n;unsigned int hash =hash_conntrack (tuple);/* Disable BHs the entire time since we normally need to disable them * at least once for the stats anyway. */ local_bh_disable (); -hlist_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnode) { +begin: +hlist_nulls_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnnode) {if (nf_ct_tuple_equal (tuple, &h->tuple)) {NF_CT_STAT_INC (net, found);local_bh_enable ();
net/netfilter/nf_conntrack_core.c __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple) · line 279
Quoted 10 lines
net/netfilter/nf_conntrack_core.c +7
-0@@ -261,6 +270,13 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple) }NF_CT_STAT_INC (net, searched); } +/* +* if the nulls value we got at the end of this lookup is +* not the expected one, we must restart lookup. +* We probably met an item that was moved to another chain. +*/ +if (get_nulls_value (n) != hash) + goto begin;
Are you sure this is enough? An entry might have been reused and added to the same chain I think, so I think we need to recheck the tuple.
Quoted 7 lines
net/netfilter/nf_conntrack_core.c +0
-0local_bh_enable ();return NULL ;@@ -275,11 +291,18 @@ nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple)struct nf_conn *ct;rcu_read_lock ();
net/netfilter/nf_conntrack_core.c nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple) · line 303
Quoted 10 lines
net/netfilter/nf_conntrack_core.c +5
-0+begin: h =__nf_conntrack_find (net, tuple);if (h) { ct =nf_ct_tuplehash_to_ctrack (h);if (unlikely (!atomic_inc_not_zero (&ct->ct_general.use))) h =NULL ; +else { +if (unlikely (!nf_ct_tuple_equal (tuple, &h->tuple))) { +nf_ct_put (ct); + goto begin;
Ah I see, the hash comparison above is only an optimization?
Quoted 5 lines
net/netfilter/nf_conntrack_core.c +2
-0+ } + } }rcu_read_unlock ();
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 60 lines · Patrick McHardy
Quoted 9 lines · Eric Dumazet
I have a litle problem on
__nf_conntrack_find()being exported.Problem is that with
SLAB_DESTROY_BY_RCUwe must take a reference on object
to recheck it. So ideally onlynf_conntrack_find_get()should be used, or callers of__nf_conntrack_find()should locknf_conntrack_lock(as properly done for example innet/netfilter/nf_conntrack_netlink.c, line 1292)Quoted 8 lines
Here is preliminary patch for review (not tested at all, its 4h50 am here :) )
Could you help me, by checking
__nf_conntrack_find()use innet/netfilter/xt_connlimit.c?
and line 1246 ofnet/netfilter/nf_conntrack_netlink.cThis part is a litle bit gray for me. :)
In case of
xt_connlimit, it seems fine to just take a reference. In case of ctnetlink, keeping the unreferenced lookup under the lock seems fine. We unfortunately have to export some internals likenf_conntracklock for ctnetlink anyways, so I don't think it would be worth to change it to take references and unexport the lookup function.Quoted 34 lines
+/*
+ * Warning :
+ * - Caller must take a reference on returned object
+ * and rechecknf_ct_tuple_equal(tuple, &h->tuple)
+ * OR
+ * - Caller must locknf_conntrack_lockbefore calling this function
+ */
structnf_conntrack_tuple_hash* __nf_conntrack_find(struct net *net, const structnf_conntrack_tuple
*tuple){ struct nf_conntrack_tuple_hash *h;net/netfilter/nf_conntrack_core.c +1
-1-struct hlist_node *n; +struct hlist_nulls_node *n;unsigned int hash =hash_conntrack (tuple);/* Disable BHs the entire time since we normally need to disable them
* at least once for the stats anyway. */ local_bh_disable();net/netfilter/nf_conntrack_core.c +4
-1-hlist_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnode) { +begin: +hlist_nulls_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnnode) {if (nf_ct_tuple_equal (tuple, &h->tuple)) {NF_CT_STAT_INC (net, found);local_bh_enable ();@@ -261,6 +270,13 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple) }NF_CT_STAT_INC (net, searched); } +/* +* if the nulls value we got at the end of this lookup is
Quoted 8 lines
net/netfilter/nf_conntrack_core.c __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple) · line 279
Quoted 5 lines
net/netfilter/nf_conntrack_core.c +5
-0+* not the expected one, we must restart lookup. +* We probably met an item that was moved to another chain. +*/ +if (get_nulls_value (n) != hash) + goto begin;Are you sure this is enough? An entry might have been reused and added to the same chain I think, so I think we need to recheck the tuple.
Yes, done in caller
Quoted 8 lines
Quoted 8 lines
net/netfilter/nf_conntrack_core.c +0
-0local_bh_enable ();return NULL;net/netfilter/nf_conntrack_core.c +0
-0@@ -275,11 +291,18 @@ nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple)struct nf_conn *ct;
Quoted 21 lines
net/netfilter/nf_conntrack_core.c nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple) · line 303
Quoted 11 lines
net/netfilter/nf_conntrack_core.c +5
-0rcu_read_lock (); +begin: h =__nf_conntrack_find (net, tuple);if (h) { ct =nf_ct_tuplehash_to_ctrack (h);if (unlikely (!atomic_inc_not_zero (&ct->ct_general.use))) h =NULL ; +else { +if (unlikely (!nf_ct_tuple_equal (tuple, &h->tuple))) { +nf_ct_put (ct); + goto begin;Ah I see, the hash comparison above is only an optimization?
Quoted 5 lines
net/netfilter/nf_conntrack_core.c +2
-0+ } + } }rcu_read_unlock ();
check net/ipv4/udp.c for an example (__udp4_lib_lookup())
In case of UDP, key check is not returning true/false, but a score. So UDP case is a litle bit more complex than conntrack case.
rcu_read_lock();
begin:
result = NULL;
badness = -1;
sk_nulls_for_each_rcu(sk, node, &hslot->head) {
score = compute_score(sk, net, saddr, hnum, sport,
daddr, dport, dif);
if (score > badness) {
result = sk;
badness = score;
}
}
/*
* if the nulls value we got at the end of this lookup is
* not the expected one, we must restart lookup.
* We probably met an item that was moved to another chain.
*/
if (get_nulls_value(node) != hash)
goto begin;
if (result) {
if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
result = NULL;
else if (unlikely(compute_score(result, net, saddr, hnum, sport,
daddr, dport, dif) < badness)) {
sock_put(result);
goto begin;
}
}
rcu_read_unlock();
return result;Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
In reply to Eric DumazetEric Dumazet <[email protected]> wrote on 24/03/2009 13:07:16:
Quoted 25 lines
Quoted 23 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 10:12:53:
Quoted 14 lines
Quoted 12 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
Quoted 7 lines
Quoted 7 lines
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernelthread
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
has
Quoted 7 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in
/proc/slabinfo.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
If that *doesn't* show any signs of a leak, please run "conntrack
-E"
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
to capture the conntrack events before the "table full" message appears and post the output.
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54
27
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 120
60
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 120
60
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 120
60
Quoted 5 lines
Quoted 5 lines
0
Quoted 4 lines
Quoted 4 lines
: slabdata 1 1 0
During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 54
27
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 120
60
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 120
60
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 120
60
Quoted 4 lines
Quoted 4 lines
0
Quoted 3 lines
Quoted 3 lines
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed
and
Quoted 22 lines
Quoted 22 lines
Quoted 3 lines
Quoted 3 lines
builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to
wait
Quoted 7 lines
Quoted 1 line
a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep RCU .config
# RCU SubsystemCONFIG_CLASSIC_RCU=y
#CONFIG_TREE_RCUis not set
#CONFIG_PREEMPT_RCUis not set
#CONFIG_TREE_RCU_TRACEis not set
#CONFIG_PREEMPT_RCU_TRACEis not set
#CONFIG_RCU_TORTURE_TESTis not set
#CONFIG_RCU_CPU_STALL_DETECTORis not set
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
grep
CONFIG_SMP.configgrep
CONFIG_SMP.config
#CONFIG_SMPis not setQuoted 1 line
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c
(line
Quoted 5 lines
Quoted 5 lines
80)
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to stress
it
Quoted 6 lines
Quoted 4 lines
pretty
hard before I saw handful "nf_conntrack: table full, dropping packet"RCU is not my cup of tea, do you have any ideas were to look?
In a stress situation, you feed more deleted conntracks to
call_rcu()
than
Quoted 6 lines
the blimit (10 real freeing per RCU softirq invocation).
So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued
items, instead
Quoted 6 lines
of a small batch of 10
To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example) Probably should be done to reduce some spikes in RCU code when
freeing
Quoted 8 lines
whole 10000 elements...OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrementnet->ct.countinnf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()
The patch fixes the problem and the system feels a bit more responsive too, thanks.
I guess I should probably do both 1) and 3) as my board is pretty slow too.
Been trying to figure out a good value for NAPI weigth too. Currently my HW RX and TX queues are 16 pkgs deep and weigth is 16 too. If I move TX processing
to NAPI context AND increase weigth to 32, the system is a lot more responsive during
ping flooding. Does weigth 32 make sense when the HW TX and RX queues are 16?
Jocke
Patrick McHardy
AppliedRe: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 4 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 13:07:16:
Quoted 1 line
[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()The patch fixes the problem and the system feels a bit more responsive too, thanks.
Applied, thanks everyone.
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
In reply to Joakim TjernlundQuoted 146 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 13:07:16:
Quoted 24 lines
Quoted 23 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 24/03/2009 10:12:53:
Quoted 14 lines
Quoted 12 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 18:49:15:
Quoted 9 lines
Quoted 8 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 5 lines
Quoted 4 lines
There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
Quoted 7 lines
Quoted 7 lines
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernelthread
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
has
Quoted 7 lines
Quoted 5 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?No. As I said, something seems to be leaking packets. You should be able to confirm that by checking the
sk_buffslabs in
/proc/slabinfo.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
If that *doesn't* show any signs of a leak, please run "conntrack
-E"
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
to capture the conntrack events before the "table full" message appears and post the output.
skbuff does not differ much, but others do
Before ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 5427
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache20 20 192 20 1 : tunables 12060
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 1 1 0 size-64 731 767 64 59 1 : tunables 12060
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 13 13 0
nf_conntrack10 19 208 19 1 : tunables 12060
Quoted 5 lines
Quoted 5 lines
0
Quoted 4 lines
Quoted 4 lines
: slabdata 1 1 0
During ping:
skbuff_fclone_cache0 0 352 11 1 : tunables 5427
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 0 0 0
skbuff_head_cache40 40 192 20 1 : tunables 12060
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 2 2 0
size-64 8909 8909 64 59 1 : tunables 12060
Quoted 3 lines
Quoted 3 lines
0
Quoted 2 lines
Quoted 2 lines
: slabdata 151 151 0
nf_conntrack5111 5111 208 19 1 : tunables 12060
Quoted 4 lines
Quoted 4 lines
0
Quoted 3 lines
Quoted 3 lines
: slabdata 269 269 0
This feels more like the freeing of conntrack objects are delayed
and
Quoted 22 lines
Quoted 22 lines
Quoted 3 lines
Quoted 3 lines
builds up when ping flooding.
Don't have "conntrack -E" for my embedded board so that will have to
wait
Quoted 7 lines
Quoted 1 line
a bit longer.
I dont understand how your ping can use so many conntrack entries...
Then, as I said yesterday, I believe you have a RCU delay, because of a misbehaving driver or something...
grep RCU .config
grep RCU .config
# RCU SubsystemCONFIG_CLASSIC_RCU=y
#CONFIG_TREE_RCUis not set
#CONFIG_PREEMPT_RCUis not set
#CONFIG_TREE_RCU_TRACEis not set
#CONFIG_PREEMPT_RCU_TRACEis not set
#CONFIG_RCU_TORTURE_TESTis not set
#CONFIG_RCU_CPU_STALL_DETECTORis not setQuoted 5 lines
Quoted 5 lines
Quoted 1 line
grep
CONFIG_SMP.configgrep
CONFIG_SMP.config
#CONFIG_SMPis not setQuoted 1 line
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c(line
Quoted 5 lines
Quoted 5 lines
80)
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to stress
it
Quoted 5 lines
Quoted 4 lines
pretty
hard before I saw handful "nf_conntrack: table full, dropping packet"RCU is not my cup of tea, do you have any ideas were to look?
In a stress situation, you feed more deleted conntracks to
call_rcu()than
Quoted 6 lines
the blimit (10 real freeing per RCU softirq invocation).
So with default qhimark being 10000, this means about 10000 conntracks can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued
items, instead
Quoted 6 lines
of a small batch of 10
To solve your problem we can :
1) reduce qhimark from 10000 to 1000 (for example) Probably should be done to reduce some spikes in RCU code when
freeing
Quoted 8 lines
whole 10000 elements...OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrementnet->ct.countinnf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()The patch fixes the problem and the system feels a bit more responsive too, thanks.
I guess I should probably do both 1) and 3) as my board is pretty slow too.
Quoted 7 lines
Been trying to figure out a good value for NAPI weigth too. Currently my HW RX and TX queues are 16 pkgs deep and weigth is 16 too. If I move TX processing
to NAPI context AND increase weigth to 32, the system is a lot more responsive during
ping flooding. Does weigth 32 make sense when the HW TX and RX queues are 16?
If you only have one NIC, I dont understand why changing weight should make a difference. Are you referring to dev_weight or netdev_budget ?
# cat /proc/sys/net/core/dev_weight 64 # cat /proc/sys/net/core/netdev_budget 300
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Eric Dumazet <[email protected]> wrote on 24/03/2009 14:29:29:
[SNIP]
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
You could change qhimark from 10000 to 1000 in
kernel/rcuclassic.c(line
Quoted 6 lines
Quoted 6 lines
80)
Quoted 1 line
as a workaround. It should force a quiescent state after 1000 freed
conntracks.
right, doing this almost killed all conntrack messages, had to
stress
Quoted 3 lines
Quoted 3 lines
it
Quoted 2 lines
Quoted 2 lines
pretty
hard before I saw handful "nf_conntrack: table full, dropping
packet"
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
RCU is not my cup of tea, do you have any ideas were to look?
In a stress situation, you feed more deleted conntracks to
call_rcu()than
Quoted 3 lines
the blimit (10 real freeing per RCU softirq invocation).
So with default qhimark being 10000, this means about 10000
conntracks
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
can sit in RCU (per CPU) before being really freed.
Only when hitting 10000, RCU enters a special mode to free all queued
items, instead
Quoted 4 lines
of a small batch of 10
To solve your problem we can :
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
1) reduce qhimark from 10000 to 1000 (for example) Probably should be done to reduce some spikes in RCU code when
freeing
Quoted 5 lines
whole 10000 elements...OR
2) change conntrack tunable (max conntrack entries on your machine) OR
3) changenet/netfilter/nf_conntrack_core.cto decrement
net->ct.count
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
in
nf_conntrack_free()instead of callback.[PATCH] conntrack: Reduce conntrack count in
nf_conntrack_free()
Quoted 8 lines
Quoted 8 lines
The patch fixes the problem and the system feels a bit more responsive
too, thanks.
I guess I should probably do both 1) and 3) as my board is pretty slowtoo.
Been trying to figure out a good value for NAPI weigth too. Currently
my
Quoted 1 line
Quoted 1 line
HW RX and TX queues are 16 pkgs deep and weigth is 16 too. If I move
TX
Quoted 4 lines
Quoted 4 lines
processing
to NAPI context AND increase weigth to 32, the system is a lot more responsive during
ping flooding. Does weigth 32 make sense when the HW TX and RX queues
are
Quoted 3 lines
Quoted 1 line
16?
If you only have one NIC, I dont understand why changing weight should
make
Quoted 6 lines
a difference. Are you referring to
dev_weightornetdev_budget?# cat /proc/sys/net/core/dev_weight 64 # cat /proc/sys/net/core/netdev_budget 300
I mean this call in ucc_geth:
netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);UCC_GETH_DEV_WEIGHT is 16
Noticed that rcuclassic.c has a
module_param(qhimark, int, 0);
But I can't figure out hot to set this qhimark from the cmdline.
rcuclassic.c is not a module(I don't use modules at all)
Jocke
Jocke
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
In reply to Eric DumazetOn Tue, 2009-03-24 at 13:07 +0100, Eric Dumazet wrote:
Hi Eric,
Quoted 6 lines
We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.
Your patch fixes the problem on my board too (embedded mips router 250Mhz), thanks.
Yet I'm concerned about what you said concerning RAM usage. I have a very small amount on memory left on my board (less than 4M), and I tuned ip route cache size and nf_conntrack_max to make sure I won't go OOM.
With your patch, does it mean 10000 conntrack entries can be allocated while nf_conntrack_max is say only 2048 ?
Regards,
Signature · 1 line
Maxime
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
Quoted 12 lines · Maxime Bizon
Quoted 6 lines · Eric Dumazet
We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.Your patch fixes the problem on my board too (embedded mips router 250Mhz), thanks.
Quoted 6 lines
Yet I'm concerned about what you said concerning RAM usage. I have a very small amount on memory left on my board (less than 4M), and I tuned ip route cache size and
nf_conntrack_maxto make sure I won't go OOM.With your patch, does it mean 10000 conntrack entries can be allocated while
nf_conntrack_maxis say only 2048 ?
Temporarily under worst-case circumstances, yes. Eric is already working on his proposed improvement though :)
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
In reply to Maxime BizonQuoted 14 lines · Maxime Bizon
On Tue, 2009-03-24 at 13:07 +0100, Eric Dumazet wrote:
Hi Eric,
Quoted 6 lines
We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.Your patch fixes the problem on my board too (embedded mips router 250Mhz), thanks.
Quoted 6 lines
Yet I'm concerned about what you said concerning RAM usage. I have a very small amount on memory left on my board (less than 4M), and I tuned ip route cache size and
nf_conntrack_maxto make sure I won't go OOM.With your patch, does it mean 10000 conntrack entries can be allocated while
nf_conntrack_maxis say only 2048 ?
Well... yes, RCU can have this 'interesting' OOM property.
For small machines, you really want to lower RCU parameters, because as you said, we also push route cache entries in RCU queue, my patch being applied or not (But using call_rcu_bh(), so we have lower latencies I think)
We are working on a SLAB_DESTROY_BY_RCU implementation so that conntrack wont use call_rcu() anymore, give us a couple of days :)
Paul, could we have /sys knobs to be able to tune qhimark, blimit & qlowmark ?
Thanks
PATCH 1/1 netfilter: Use hlist_add_head_rcu() in nf_conntrack_set_hashsize()
Quoted 4 lines · Eric Dumazet
We are working on a
SLAB_DESTROY_BY_RCUimplementation so that conntrack wont usecall_rcu()anymore, give us a couple of days :)
While working on this stuff, I found one suspect use of hlist_add_head()
Its not a hot path, I believe following patch would make sure nothing wrong happens.
If a chain contains element A and B, then we might build a new table with a new chain containing B and A (in this reverse order), and a cpu could see A->next = B (new pointer), B->next = A (old pointer)
Thanks
[PATCH] netfilter: Use hlist_add_head_rcu() in nf_conntrack_set_hashsize()
Using hlist_add_head() in nf_conntrack_set_hashsize() is quite dangerous. Without any barrier, one CPU could see a loop while doing its lookup. Its true new table cannot be seen by another cpu, but previous table is still readable.
net/netfilter/nf_conntrack_core.c +1 -1
@@ -1121,7 +1121,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp) struct nf_conntrack_tuple_hash, hnode);hlist_del_rcu (&h->hnode); bucket =__hash_conntrack (&h->tuple, hashsize, rnd); -hlist_add_head (&h->hnode, &hash[bucket]); +hlist_add_head_rcu (&h->hnode, &hash[bucket]); } } old_size = nf_conntrack_htable_size;
Patrick McHardy
AppliedRe: [PATCH] netfilter: Use hlist_add_head_rcu() in nf_conntrack_set_hashsize()
Quoted 8 lines · Eric Dumazet
While working on this stuff, I found one suspect use of
hlist_add_head()Its not a hot path, I believe following patch would make sure nothing wrong happens.
If a chain contains element A and B, then we might build a new table with a new chain containing B and A (in this reverse order), and a cpu could see
A->next= B (new pointer),B->next= A (old pointer)
I think you're right.
Quoted 6 lines
[PATCH] netfilter: Use
hlist_add_head_rcu()innf_conntrack_set_hashsize()Using
hlist_add_head()innf_conntrack_set_hashsize()is quite dangerous. Without any barrier, one CPU could see a loop while doing its lookup. Its true new table cannot be seen by another cpu, but previous table is still readable.
Applied, thanks Eric.
PATCH 1/1 conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
In reply to Eric DumazetHi Patrick
Here is the patch I had the time to test this time... No problem so far on my machine.
I did a UDP flood stress.
Thank you
[PATCH] conntrack: use SLAB_DESTROY_BY_RCU and get rid of call_rcu()
Use "hlist_nulls" infrastructure we added in 2.6.29 for RCUification of UDP & TCP.
This permits an easy conversion from call_rcu() based hash lists to a SLAB_DESTROY_BY_RCU one.
Avoiding call_rcu() delay at nf_conn freeing time has numerous gains.
First, it doesnt fill RCU queues (up to 10000 elements per cpu). This reduces OOM possibility, if queued elements are not taken into account This reduces latency problems when RCU queue size hits hilimit and triggers emergency mode.
- It allows fast reuse of just freed elements, permitting better use of CPU cache.
- We delete rcu_head from "struct nf_conn", shrinking size of this structure by 8 or 16 bytes.
This patch only takes care of "struct nf_conn". call_rcu() is still used for less critical conntrack parts, that may be converted later if necessary.
--- include/net/netfilter/nf_conntrack.h | 14 - include/net/netfilter/nf_conntrack_tuple.h | 6 include/net/netns/conntrack.h | 5 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 16 - net/ipv4/netfilter/nf_nat_core.c | 2 net/netfilter/nf_conntrack_core.c | 123 +++++----- net/netfilter/nf_conntrack_expect.c | 2 net/netfilter/nf_conntrack_helper.c | 7 net/netfilter/nf_conntrack_netlink.c | 10 net/netfilter/nf_conntrack_standalone.c | 16 - net/netfilter/xt_connlimit.c | 4 11 files changed, 114 insertions(+), 91 deletions(-)
include/net/netfilter/nf_conntrack.h +8 -6
@@ -91,8 +91,7 @@ struct nf_conn_help {#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> #include <net/netfilter/ipv6/nf_conntrack_ipv6.h> -struct nf_conn -{ +struct nf_conn {/* Usage count in here is 1 for hash table/destruct timer, 1 per skb, plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn#ifdef CONFIG_NET_NS struct net *ct_net;#endif -struct rcu_head rcu; }; static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)extern int nf_ct_l3proto_try_module_get (unsigned short l3proto);extern void nf_ct_l3proto_module_put (unsigned short l3proto); -extern struct hlist_head *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced); -extern void nf_ct_free_hashtable (struct hlist_head *hash,int vmalloced, -unsigned int size); +/* +* Allocate a hashtable of hlist_head (if nulls == 0), +* or hlist_nulls_head (if nulls == 1) +*/ +extern void *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced,int nulls); + +extern void nf_ct_free_hashtable (void *hash,int vmalloced,unsigned int size);extern struct nf_conntrack_tuple_hash *__nf_conntrack_find (struct net *net,const struct nf_conntrack_tuple *tuple);
include/net/netfilter/nf_conntrack_tuple.h +3 -3
@@ -12,6 +12,7 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> +#include <linux/list_nulls.h> /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) ((enum ip_conntrack_dir )(h)->tuple.dst.dir) /* Connections have two entries in the hash table: one for each way */ -struct nf_conntrack_tuple_hash -{ -struct hlist_node hnode; +struct nf_conntrack_tuple_hash { +struct hlist_nulls_node hnnode;struct nf_conntrack_tuple tuple; };
include/net/netns/conntrack.h +3 -2
@@ -2,6 +2,7 @@#define __NETNS_CONNTRACK_H#include <linux/list.h> +#include <linux/list_nulls.h> #include <asm/atomic.h> struct ctl_table_header ;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;struct netns_ct {atomic_t count;unsigned int expect_count; -struct hlist_head *hash; +struct hlist_nulls_head *hash;struct hlist_head *expect_hash; -struct hlist_head unconfirmed; +struct hlist_nulls_head unconfirmed;struct ip_conntrack_stat *stat;#ifdef CONFIG_NF_CONNTRACK_EVENTS struct nf_conntrack_ecache *ecache;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +8 -8
@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);
@@ -56,9 +56,9 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head)while (pos && (head =ct_get_next (seq, head)))
net/ipv4/netfilter/nf_nat_core.c +1 -1
@@ -679,7 +679,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,static int __net_init nf_nat_net_init (struct net *net) { net->ipv4.nat_bysource =nf_ct_alloc_hashtable (&nf_nat_htable_size, - &net->ipv4.nat_vmalloced); + &net->ipv4.nat_vmalloced,0 );if (!net->ipv4.nat_bysource)return -ENOMEM ;return 0 ;
net/netfilter/nf_conntrack_core.c +70 -53
319 lines not on this page · raw message
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -604,7 +604,7 @@ int nf_conntrack_expect_init(struct net *net) net->ct.expect_count =0 ; net->ct.expect_hash =nf_ct_alloc_hashtable (&nf_ct_expect_hsize, - &net->ct.expect_vmalloc); + &net->ct.expect_vmalloc,0 );if (net->ct.expect_hash ==NULL ) goto err1;
net/netfilter/nf_conntrack_helper.c +4 -3
@@ -158,6 +158,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,struct nf_conntrack_tuple_hash *h;struct nf_conntrack_expect *exp;const struct hlist_node *n, *next; +const struct hlist_nulls_node *nn;unsigned int i;/* Get rid of expectations */
@@ -174,10 +175,10 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me, }/* Get rid of expecteds, set helpers to NULL. */ -hlist_for_each_entry (h, n, &net->ct.unconfirmed, hnode) +hlist_for_each_entry (h, nn, &net->ct.unconfirmed, hnnode)unhelp (h, me);for (i =0 ; i < nf_conntrack_htable_size; i++) { -hlist_for_each_entry (h, n, &net->ct.hash[i], hnode) +hlist_nulls_for_each_entry (h, nn, &net->ct.hash[i], hnnode)unhelp (h, me); } }
@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );if (!nf_ct_helper_hash)return -ENOMEM ;
net/netfilter/nf_conntrack_netlink.c +5 -5
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/rculist.h> +#include <linux/rculist_nulls.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/skbuff.h>
@@ -536,7 +537,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) {struct nf_conn *ct, *last;struct nf_conntrack_tuple_hash *h; -struct hlist_node *n; +struct hlist_nulls_node *n;struct nfgenmsg *nfmsg =NLMSG_DATA (cb->nlh);u_int8_t l3proto = nfmsg->nfgen_family;
@@ -544,8 +545,8 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) last = (struct nf_conn *)cb->args[1 ];for (; cb->args[0 ] < nf_conntrack_htable_size; cb->args[0 ]++) { restart: -hlist_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], - hnode) { +hlist_nulls_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], + hnnode) {if (NF_CT_DIRECTION (h) !=IP_CT_DIR_ORIGINAL )continue ; ct =nf_ct_tuplehash_to_ctrack (h);
@@ -1242,13 +1243,12 @@ ctnetlink_create_conntrack(struct nlattr *cda[],if (err <0 ) goto err2; - master_h =__nf_conntrack_find (&init_net, &master); + master_h =nf_conntrack_find_get (&init_net, &master);if (master_h ==NULL ) { err = -ENOENT ; goto err2; } master_ct =nf_ct_tuplehash_to_ctrack (master_h); -nf_conntrack_get (&master_ct->ct_general);__set_bit (IPS_EXPECTED_BIT , &ct->status); ct->master = master_ct; }
net/netfilter/nf_conntrack_standalone.c +8 -8
@@ -44,30 +44,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);
@@ -75,9 +75,9 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head)while (pos && (head =ct_get_next (seq, head)))
net/netfilter/xt_connlimit.c +3 -1
@@ -123,7 +123,7 @@ static int count_them(struct xt_connlimit_data *data,/* check the saved connections */ list_for_each_entry_safe (conn, tmp, hash, list) { - found =__nf_conntrack_find (&init_net, &conn->tuple); + found =nf_conntrack_find_get (&init_net, &conn->tuple); found_ct =NULL ;if (found !=NULL )
@@ -151,6 +151,7 @@ static int count_them(struct xt_connlimit_data *data,* we do not care about connections which are * closed already -> ditch it */ +nf_ct_put (found_ct);list_del (&conn->list);kfree (conn);continue ;
@@ -160,6 +161,7 @@ static int count_them(struct xt_connlimit_data *data, match->family))/* same source network -> be counted! */ ++matches; +nf_ct_put (found_ct); }rcu_read_unlock ();
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 5 lines · Eric Dumazet
Hi Patrick
Here is the patch I had the time to test this time... No problem so far on my machine.
I did a UDP flood stress.
Thanks Eric. Most parts looks good, just two questions below:
Quoted 16 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +2
-2@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c struct ct_iter_state { · line 42
Quoted 10 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +1
-1for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; }
Don't we need to make sure the entry is not reused while dumping it?
Quoted 26 lines
net/netfilter/nf_conntrack_helper.c +3
-2@@ -158,6 +158,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,struct nf_conntrack_tuple_hash *h;struct nf_conntrack_expect *exp;const struct hlist_node *n, *next; +const struct hlist_nulls_node *nn;unsigned int i;/* Get rid of expectations */ @@ -174,10 +175,10 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me, }/* Get rid of expecteds, set helpers to NULL. */ -hlist_for_each_entry (h, n, &net->ct.unconfirmed, hnode) +hlist_for_each_entry (h, nn, &net->ct.unconfirmed, hnnode)unhelp (h, me);for (i =0 ; i < nf_conntrack_htable_size; i++) { -hlist_for_each_entry (h, n, &net->ct.hash[i], hnode) +hlist_nulls_for_each_entry (h, nn, &net->ct.hash[i], hnnode)unhelp (h, me); } }
net/netfilter/nf_conntrack_helper.c int nf_conntrack_helper_init(void) · line 221
Quoted 5 lines
net/netfilter/nf_conntrack_helper.c +1
-1@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );
This should be "1" I think since it wants a hlist_nulls hash.
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 8 lines · Patrick McHardy
net/netfilter/nf_conntrack_helper.c int nf_conntrack_helper_init(void) · line 221
Quoted 6 lines
net/netfilter/nf_conntrack_helper.c +1
-1@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );This should be "1" I think since it wants a
hlist_nullshash.
OK I just realized my mistake, please ignore :)
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
In reply to Patrick McHardyQuoted 26 lines · Patrick McHardy
Quoted 5 lines · Eric Dumazet
Hi Patrick
Here is the patch I had the time to test this time... No problem so far on my machine.
I did a UDP flood stress.Thanks Eric. Most parts looks good, just two questions below:
Quoted 17 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +2
-2@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;
Quoted 14 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c struct ct_iter_state { · line 42
Quoted 10 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +1
-1for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; }Don't we need to make sure the entry is not reused while dumping it?
Ah yes, I forgot that for UDP/TCP I had to change locking on this part. Because messing with reference count was crazy...
But in UDP/TCP we have different spinlock for each chain, so hold time was small enough.
So I guess that with central conntrack lock, we need to take references on entries while dumping them.
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 22 lines · Eric Dumazet
Quoted 17 lines · Patrick McHardy
Quoted 7 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +2
-1+static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c struct ct_iter_state { · line 42
Quoted 10 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +1
-1for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; }Quoted 3 lines
Don't we need to make sure the entry is not reused while dumping it?
Quoted 7 lines
Ah yes, I forgot that for UDP/TCP I had to change locking on this part. Because messing with reference count was crazy...
But in UDP/TCP we have different spinlock for each chain, so hold time was small enough.So I guess that with central conntrack lock, we need to take references on entries while dumping them.
Yes, I think so too.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 28 lines · Patrick McHardy
Quoted 27 lines · Eric Dumazet
Quoted 17 lines · Patrick McHardy
Quoted 7 lines
(quoted diff) +2
-1+static struct hlist_nulls_node *ct_get_first(struct seq_file *seq) { struct net *net = seq_file_net(seq); struct ct_iter_state *st = seq->private; - struct hlist_node *n; + struct hlist_nulls_node *n;Review
Quoted 10 lines
(quoted diff) +1
-1for (st->bucket = 0; st->bucket < nf_conntrack_htable_size; st->bucket++) { n = rcu_dereference(net->ct.hash[st->bucket].first); - if (n) + if (!is_a_nulls(n)) return n; } return NULL; }Quoted 3 lines
Don't we need to make sure the entry is not reused while dumping it?
Ah yes, I forgot that for UDP/TCP I had to change locking on this part. Because messing with reference count was crazy...
But in UDP/TCP we have different spinlock for each chain, so hold time was small enough.
Quoted 5 lines
Quoted 3 lines
So I guess that with central conntrack lock, we need to take references on entries
while dumping them.Yes, I think so too.
Here is take 2 of the patch with proper ref counting on dumping.
Thank you
[PATCH] conntrack: use SLAB_DESTROY_BY_RCU and get rid of call_rcu()
Use "hlist_nulls" infrastructure we added in 2.6.29 for RCUification of UDP & TCP.
This permits an easy conversion from call_rcu() based hash lists to a SLAB_DESTROY_BY_RCU one.
Avoiding call_rcu() delay at nf_conn freeing time has numerous gains.
First, it doesnt fill RCU queues (up to 10000 elements per cpu). This reduces OOM possibility, if queued elements are not taken into account This reduces latency problems when RCU queue size hits hilimit and triggers emergency mode.
- It allows fast reuse of just freed elements, permitting better use of CPU cache.
- We delete rcu_head from "struct nf_conn", shrinking size of this structure by 8 or 16 bytes.
This patch only takes care of "struct nf_conn". call_rcu() is still used for less critical conntrack parts, that may be converted later if necessary.
--- include/net/netfilter/nf_conntrack.h | 14 - include/net/netfilter/nf_conntrack_tuple.h | 6 include/net/netns/conntrack.h | 5 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 57 ++-- net/ipv4/netfilter/nf_nat_core.c | 2 net/netfilter/nf_conntrack_core.c | 123 +++++----- net/netfilter/nf_conntrack_expect.c | 2 net/netfilter/nf_conntrack_helper.c | 7 net/netfilter/nf_conntrack_netlink.c | 20 - net/netfilter/nf_conntrack_standalone.c | 51 ++-- net/netfilter/xt_connlimit.c | 6 11 files changed, 166 insertions(+), 127 deletions(-)
include/net/netfilter/nf_conntrack.h +8 -6
@@ -91,8 +91,7 @@ struct nf_conn_help {#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> #include <net/netfilter/ipv6/nf_conntrack_ipv6.h> -struct nf_conn -{ +struct nf_conn {/* Usage count in here is 1 for hash table/destruct timer, 1 per skb, plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn#ifdef CONFIG_NET_NS struct net *ct_net;#endif -struct rcu_head rcu; }; static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)extern int nf_ct_l3proto_try_module_get (unsigned short l3proto);extern void nf_ct_l3proto_module_put (unsigned short l3proto); -extern struct hlist_head *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced); -extern void nf_ct_free_hashtable (struct hlist_head *hash,int vmalloced, -unsigned int size); +/* +* Allocate a hashtable of hlist_head (if nulls == 0), +* or hlist_nulls_head (if nulls == 1) +*/ +extern void *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced,int nulls); + +extern void nf_ct_free_hashtable (void *hash,int vmalloced,unsigned int size);extern struct nf_conntrack_tuple_hash *__nf_conntrack_find (struct net *net,const struct nf_conntrack_tuple *tuple);
include/net/netfilter/nf_conntrack_tuple.h +3 -3
@@ -12,6 +12,7 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> +#include <linux/list_nulls.h> /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) ((enum ip_conntrack_dir )(h)->tuple.dst.dir) /* Connections have two entries in the hash table: one for each way */ -struct nf_conntrack_tuple_hash -{ -struct hlist_node hnode; +struct nf_conntrack_tuple_hash { +struct hlist_nulls_node hnnode;struct nf_conntrack_tuple tuple; };
include/net/netns/conntrack.h +3 -2
@@ -2,6 +2,7 @@#define __NETNS_CONNTRACK_H#include <linux/list.h> +#include <linux/list_nulls.h> #include <asm/atomic.h> struct ctl_table_header ;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;struct netns_ct {atomic_t count;unsigned int expect_count; -struct hlist_head *hash; +struct hlist_nulls_head *hash;struct hlist_head *expect_hash; -struct hlist_head unconfirmed; +struct hlist_nulls_head unconfirmed;struct ip_conntrack_stat *stat;#ifdef CONFIG_NF_CONNTRACK_EVENTS struct nf_conntrack_ecache *ecache;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +32 -25
140 lines not on this page · raw message
net/ipv4/netfilter/nf_nat_core.c +1 -1
@@ -679,7 +679,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,static int __net_init nf_nat_net_init (struct net *net) { net->ipv4.nat_bysource =nf_ct_alloc_hashtable (&nf_nat_htable_size, - &net->ipv4.nat_vmalloced); + &net->ipv4.nat_vmalloced,0 );if (!net->ipv4.nat_bysource)return -ENOMEM ;return 0 ;
net/netfilter/nf_conntrack_core.c +70 -53
319 lines not on this page · raw message
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -604,7 +604,7 @@ int nf_conntrack_expect_init(struct net *net) net->ct.expect_count =0 ; net->ct.expect_hash =nf_ct_alloc_hashtable (&nf_ct_expect_hsize, - &net->ct.expect_vmalloc); + &net->ct.expect_vmalloc,0 );if (net->ct.expect_hash ==NULL ) goto err1;
net/netfilter/nf_conntrack_helper.c +4 -3
@@ -158,6 +158,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,struct nf_conntrack_tuple_hash *h;struct nf_conntrack_expect *exp;const struct hlist_node *n, *next; +const struct hlist_nulls_node *nn;unsigned int i;/* Get rid of expectations */
@@ -174,10 +175,10 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me, }/* Get rid of expecteds, set helpers to NULL. */ -hlist_for_each_entry (h, n, &net->ct.unconfirmed, hnode) +hlist_for_each_entry (h, nn, &net->ct.unconfirmed, hnnode)unhelp (h, me);for (i =0 ; i < nf_conntrack_htable_size; i++) { -hlist_for_each_entry (h, n, &net->ct.hash[i], hnode) +hlist_nulls_for_each_entry (h, nn, &net->ct.hash[i], hnnode)unhelp (h, me); } }
@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );if (!nf_ct_helper_hash)return -ENOMEM ;
net/netfilter/nf_conntrack_netlink.c +11 -9
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/rculist.h> +#include <linux/rculist_nulls.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/skbuff.h>
@@ -536,7 +537,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) {struct nf_conn *ct, *last;struct nf_conntrack_tuple_hash *h; -struct hlist_node *n; +struct hlist_nulls_node *n;struct nfgenmsg *nfmsg =NLMSG_DATA (cb->nlh);u_int8_t l3proto = nfmsg->nfgen_family;
@@ -544,27 +545,27 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) last = (struct nf_conn *)cb->args[1 ];for (; cb->args[0 ] < nf_conntrack_htable_size; cb->args[0 ]++) { restart: -hlist_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], - hnode) { +hlist_nulls_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], + hnnode) {if (NF_CT_DIRECTION (h) !=IP_CT_DIR_ORIGINAL )continue ; ct =nf_ct_tuplehash_to_ctrack (h); +if (!atomic_inc_not_zero (&ct->ct_general.use)) +continue ;/* Dump entries of a given L3 protocol number. * If it is not specified, ie. l3proto == 0, * then dump everything. */ if (l3proto &&nf_ct_l3num (ct) != l3proto) -continue ; + goto releasect;if (cb->args[1 ]) {if (ct != last) -continue ; + goto releasect; cb->args[1 ] =0 ; }if (ctnetlink_fill_info (skb,NETLINK_CB (cb->skb).pid, cb->nlh->nlmsg_seq,IPCTNL_MSG_CT_NEW ,1 , ct) <0 ) { -if (!atomic_inc_not_zero (&ct->ct_general.use)) -continue ; cb->args[1 ] = (unsigned long )ct; goto out; }
@@ -577,6 +578,8 @@ restart:if (acct)memset (acct,0 ,sizeof (struct nf_conn_counter [IP_CT_DIR_MAX ])); } +releasect: +nf_ct_put (ct); }if (cb->args[1 ]) { cb->args[1 ] =0 ;
@@ -1242,13 +1245,12 @@ ctnetlink_create_conntrack(struct nlattr *cda[],if (err <0 ) goto err2; - master_h =__nf_conntrack_find (&init_net, &master); + master_h =nf_conntrack_find_get (&init_net, &master);if (master_h ==NULL ) { err = -ENOENT ; goto err2; } master_ct =nf_ct_tuplehash_to_ctrack (master_h); -nf_conntrack_get (&master_ct->ct_general);__set_bit (IPS_EXPECTED_BIT , &ct->status); ct->master = master_ct; }
net/netfilter/nf_conntrack_standalone.c +29 -22
135 lines not on this page · raw message
net/netfilter/xt_connlimit.c +4 -2
@@ -108,7 +108,7 @@ static int count_them(struct xt_connlimit_data *data,const struct nf_conntrack_tuple_hash *found;struct xt_connlimit_conn *conn;struct xt_connlimit_conn *tmp; -const struct nf_conn *found_ct; +struct nf_conn *found_ct;struct list_head *hash;bool addit = true;int matches =0 ;
@@ -123,7 +123,7 @@ static int count_them(struct xt_connlimit_data *data,/* check the saved connections */ list_for_each_entry_safe (conn, tmp, hash, list) { - found =__nf_conntrack_find (&init_net, &conn->tuple); + found =nf_conntrack_find_get (&init_net, &conn->tuple); found_ct =NULL ;if (found !=NULL )
@@ -151,6 +151,7 @@ static int count_them(struct xt_connlimit_data *data,* we do not care about connections which are * closed already -> ditch it */ +nf_ct_put (found_ct);list_del (&conn->list);kfree (conn);continue ;
@@ -160,6 +161,7 @@ static int count_them(struct xt_connlimit_data *data, match->family))/* same source network -> be counted! */ ++matches; +nf_ct_put (found_ct); }rcu_read_unlock ();
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 1 line · Eric Dumazet
Here is take 2 of the patch with proper ref counting on dumping.
Thanks, one final question about the seq-file handling:
Quoted 58 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +8
-9@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);@@ -56,9 +56,9 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head)while (pos && (head =ct_get_next (seq, head)))@@ -87,69 +87,76 @@ static void ct_seq_stop(struct seq_file *s, void *v)static int ct_seq_show (struct seq_file *s,void *v) { -const struct nf_conntrack_tuple_hash *hash = v;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c static void ct_seq_stop(struct seq_file *s, void *v) · line 98
Quoted 10 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +5
-1-const struct nf_conn *ct =nf_ct_tuplehash_to_ctrack (hash); +struct nf_conntrack_tuple_hash *hash = v; +struct nf_conn *ct =nf_ct_tuplehash_to_ctrack (hash);const struct nf_conntrack_l3proto *l3proto;const struct nf_conntrack_l4proto *l4proto; +int ret =0 ;NF_CT_ASSERT (ct); +if (unlikely (!atomic_inc_not_zero (&ct->ct_general.use))) +return 0 ;
Can we assume the next pointer still points to the next entry in the same chain after the refcount dropped to zero?
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 73 lines · Patrick McHardy
Quoted 1 line · Eric Dumazet
Here is take 2 of the patch with proper ref counting on dumping.
Thanks, one final question about the seq-file handling:
Quoted 68 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +8
-8@@ -25,30 +25,30 @@ struct ct_iter_state {unsigned int bucket; }; -static struct hlist_node *ct_get_first (struct seq_file *seq) +static struct hlist_nulls_node *ct_get_first (struct seq_file *seq) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; -struct hlist_node *n; +struct hlist_nulls_node *n;for (st->bucket =0 ; st->bucket < nf_conntrack_htable_size; st->bucket++) { n =rcu_dereference (net->ct.hash[st->bucket].first); -if (n) +if (!is_a_nulls (n))return n; }return NULL ; } -static struct hlist_node *ct_get_next (struct seq_file *seq, -struct hlist_node *head) +static struct hlist_nulls_node *ct_get_next (struct seq_file *seq, +struct hlist_nulls_node *head) {struct net *net =seq_file_net (seq);struct ct_iter_state *st = seq->private; head =rcu_dereference (head->next); -while (head ==NULL ) { +while (is_a_nulls (head)) {if (++st->bucket >= nf_conntrack_htable_size)return NULL ; head =rcu_dereference (net->ct.hash[st->bucket].first);@@ -56,9 +56,9 @@ static struct hlist_node *ct_get_next(structseq_file *seq, return head; } -static struct hlist_node *ct_get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_nulls_node *ct_get_idx (struct seq_file *seq,loff_t pos) { -struct hlist_node *head =ct_get_first (seq); +struct hlist_nulls_node *head =ct_get_first (seq);if (head) while (pos && (head = ct_get_next(seq, head)))net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +3
-2@@ -87,69 +87,76 @@ static void ct_seq_stop(struct seq_file *s, void *v)static int ct_seq_show (struct seq_file *s,void *v) { -const struct nf_conntrack_tuple_hash *hash = v; -const struct nf_conn *ct =nf_ct_tuplehash_to_ctrack (hash); +struct nf_conntrack_tuple_hash *hash = v; +struct nf_conn *ct =nf_ct_tuplehash_to_ctrack (hash);const struct nf_conntrack_l3proto *l3proto;const struct nf_conntrack_l4proto *l4proto; +int ret =0 ;
Quoted 9 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c static void ct_seq_stop(struct seq_file *s, void *v) · line 98
Quoted 3 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +2
-0NF_CT_ASSERT (ct); +if (unlikely (!atomic_inc_not_zero (&ct->ct_general.use))) +return 0 ;Can we assume the next pointer still points to the next entry in the same chain after the refcount dropped to zero?
We are looking chain N.
If we cannot atomic_inc() refcount, we got some deleted entry.
If we could atomic_inc, we can meet an entry that just moved to another chain X
When hitting its end, we continue the search to the N+1 chain so we only skip the end of previous chain (N). We can 'forget' some entries, we can print several time one given entry.
We could solve this by :
1) Checking hash value : if not one expected ->
Going back to head of chain N, (potentially re-printing already handled entries) So it is not a *perfect* solution.
2) Use a locking to forbid writers (as done in UDP/TCP), but it is expensive and wont solve other problem :
We wont avoid emitting same entry several time anyway (this is a flaw of current seq_file handling, since we 'count' entries to be skiped, and this is wrong if some entries were deleted or inserted meanwhile)
We have same problem on /proc/net/udp & /proc/net/tcp, I am not sure we should care...
Also, current resizing code can give to a /proc/net/ip_conntrack reader a problem, since hash table can switch while its doing its dumping : many entries might be lost or regiven...
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 22 lines · Eric Dumazet
Quoted 6 lines · Patrick McHardy
Review
Quoted 3 lines
NF_CT_ASSERT(ct);(quoted diff) +2
-0+ if (unlikely(!atomic_inc_not_zero(&ct->ct_general.use))) + return 0;Can we assume the next pointer still points to the next entry in the same chain after the refcount dropped to zero?
We are looking chain N.
If we cannotatomic_inc()refcount, we got some deleted entry.
If we couldatomic_inc, we can meet an entry that just moved to another chain XWhen hitting its end, we continue the search to the N+1 chain so we only skip the end of previous chain (N). We can 'forget' some entries, we can print several time one given entry.
We could solve this by :
1) Checking hash value : if not one expected ->
Going back to head of chain N, (potentially re-printing already handled entries) So it is not a *perfect* solution.
Quoted 7 lines
2) Use a locking to forbid writers (as done in UDP/TCP), but it is expensive and wont solve other problem :
We wont avoid emitting same entry several time anyway (this is a flaw of current
seq_filehandling, since we 'count' entries to be skiped, and this is wrong if some entries were deleted or inserted meanwhile)We have same problem on
/proc/net/udp&/proc/net/tcp, I am not sure we should care...
I think double entries are not a problem, as you say, there are already other cases where this can happen. But I think we should try our best that every entry present at the start and still present at the end of a dump is also contained in the dump, otherwise the guantees seem to weak to still be useful. Your first proposal would do exactly that, right?
Quoted 2 lines
Also, current resizing code can give to a
/proc/net/ip_conntrackreader a problem, since hash table can switch while its doing its dumping : many entries might be lost or regiven...
Thats true. But its a very rare operation, so I think its mainly a documentation issue.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 38 lines · Patrick McHardy
Quoted 29 lines · Eric Dumazet
Quoted 6 lines · Patrick McHardy
Review
Quoted 3 lines
NF_CT_ASSERT(ct);(quoted diff) +2
-0+ if (unlikely(!atomic_inc_not_zero(&ct->ct_general.use))) + return 0;Can we assume the next pointer still points to the next entry in the same chain after the refcount dropped to zero?
We are looking chain N.
If we cannotatomic_inc()refcount, we got some deleted entry. If we couldatomic_inc, we can meet an entry that just moved to another chain XWhen hitting its end, we continue the search to the N+1 chain so we only skip the end of previous chain (N). We can 'forget' some entries, we can print
several time one given entry.We could solve this by :
1) Checking hash value : if not one expected -> Going back to head
of chain N, (potentially re-printing already handled entries)
So it is not a *perfect* solution.2) Use a locking to forbid writers (as done in UDP/TCP), but it is expensive and
wont solve other problem :Quoted 7 lines
We wont avoid emitting same entry several time anyway (this is a flaw of current
seq_filehandling, since we 'count' entries to be skiped, and this is
wrong if some entries were deleted or inserted meanwhile)We have same problem on
/proc/net/udp&/proc/net/tcp, I am not sure we should care...
Quoted 6 lines
I think double entries are not a problem, as you say, there are already other cases where this can happen. But I think we should try our best that every entry present at the start and still present at the end of a dump is also contained in the dump, otherwise the guantees seem to weak to still be useful. Your first proposal would do exactly that, right?
If your concern is to not forget entries, and we are allowed to print some entries several times, then we can just check the final "nulls" value, and if we find a different value than expected for chain N, go back to begining of chain N.
No need to check hash value (this could help not print several time same entry, we dont care that much)
+ while (is_a_nulls(head)) {
+ if (likely(get_nulls_value(head) == st->bucket)) {
+ if (++st->bucket >= nf_conntrack_htable_size)
+ return NULL;
+ }
Thank you
[PATCH] conntrack: use SLAB_DESTROY_BY_RCU and get rid of call_rcu()
Use "hlist_nulls" infrastructure we added in 2.6.29 for RCUification of UDP & TCP.
This permits an easy conversion from call_rcu() based hash lists to a SLAB_DESTROY_BY_RCU one.
Avoiding call_rcu() delay at nf_conn freeing time has numerous gains.
First, it doesnt fill RCU queues (up to 10000 elements per cpu). This reduces OOM possibility, if queued elements are not taken into account This reduces latency problems when RCU queue size hits hilimit and triggers emergency mode.
- It allows fast reuse of just freed elements, permitting better use of CPU cache.
- We delete rcu_head from "struct nf_conn", shrinking size of this structure by 8 or 16 bytes.
This patch only takes care of "struct nf_conn". call_rcu() is still used for less critical conntrack parts, that may be converted later if necessary.
--- include/net/netfilter/nf_conntrack.h | 14 - include/net/netfilter/nf_conntrack_tuple.h | 6 include/net/netns/conntrack.h | 5 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 63 ++--- net/ipv4/netfilter/nf_nat_core.c | 2 net/netfilter/nf_conntrack_core.c | 123 +++++----- net/netfilter/nf_conntrack_expect.c | 2 net/netfilter/nf_conntrack_helper.c | 7 net/netfilter/nf_conntrack_netlink.c | 20 - net/netfilter/nf_conntrack_standalone.c | 57 ++-- net/netfilter/xt_connlimit.c | 6 11 files changed, 174 insertions(+), 131 deletions(-)
include/net/netfilter/nf_conntrack.h +8 -6
@@ -91,8 +91,7 @@ struct nf_conn_help {#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> #include <net/netfilter/ipv6/nf_conntrack_ipv6.h> -struct nf_conn -{ +struct nf_conn {/* Usage count in here is 1 for hash table/destruct timer, 1 per skb, plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn#ifdef CONFIG_NET_NS struct net *ct_net;#endif -struct rcu_head rcu; }; static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)extern int nf_ct_l3proto_try_module_get (unsigned short l3proto);extern void nf_ct_l3proto_module_put (unsigned short l3proto); -extern struct hlist_head *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced); -extern void nf_ct_free_hashtable (struct hlist_head *hash,int vmalloced, -unsigned int size); +/* +* Allocate a hashtable of hlist_head (if nulls == 0), +* or hlist_nulls_head (if nulls == 1) +*/ +extern void *nf_ct_alloc_hashtable (unsigned int *sizep,int *vmalloced,int nulls); + +extern void nf_ct_free_hashtable (void *hash,int vmalloced,unsigned int size);extern struct nf_conntrack_tuple_hash *__nf_conntrack_find (struct net *net,const struct nf_conntrack_tuple *tuple);
include/net/netfilter/nf_conntrack_tuple.h +3 -3
@@ -12,6 +12,7 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> +#include <linux/list_nulls.h> /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) ((enum ip_conntrack_dir )(h)->tuple.dst.dir) /* Connections have two entries in the hash table: one for each way */ -struct nf_conntrack_tuple_hash -{ -struct hlist_node hnode; +struct nf_conntrack_tuple_hash { +struct hlist_nulls_node hnnode;struct nf_conntrack_tuple tuple; };
include/net/netns/conntrack.h +3 -2
@@ -2,6 +2,7 @@#define __NETNS_CONNTRACK_H#include <linux/list.h> +#include <linux/list_nulls.h> #include <asm/atomic.h> struct ctl_table_header ;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;struct netns_ct {atomic_t count;unsigned int expect_count; -struct hlist_head *hash; +struct hlist_nulls_head *hash;struct hlist_head *expect_hash; -struct hlist_head unconfirmed; +struct hlist_nulls_head unconfirmed;struct ip_conntrack_stat *stat;#ifdef CONFIG_NF_CONNTRACK_EVENTS struct nf_conntrack_ecache *ecache;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +36 -27
145 lines not on this page · raw message
net/ipv4/netfilter/nf_nat_core.c +1 -1
@@ -679,7 +679,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct,static int __net_init nf_nat_net_init (struct net *net) { net->ipv4.nat_bysource =nf_ct_alloc_hashtable (&nf_nat_htable_size, - &net->ipv4.nat_vmalloced); + &net->ipv4.nat_vmalloced,0 );if (!net->ipv4.nat_bysource)return -ENOMEM ;return 0 ;
net/netfilter/nf_conntrack_core.c +70 -53
319 lines not on this page · raw message
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -604,7 +604,7 @@ int nf_conntrack_expect_init(struct net *net) net->ct.expect_count =0 ; net->ct.expect_hash =nf_ct_alloc_hashtable (&nf_ct_expect_hsize, - &net->ct.expect_vmalloc); + &net->ct.expect_vmalloc,0 );if (net->ct.expect_hash ==NULL ) goto err1;
net/netfilter/nf_conntrack_helper.c +4 -3
@@ -158,6 +158,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,struct nf_conntrack_tuple_hash *h;struct nf_conntrack_expect *exp;const struct hlist_node *n, *next; +const struct hlist_nulls_node *nn;unsigned int i;/* Get rid of expectations */
@@ -174,10 +175,10 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me, }/* Get rid of expecteds, set helpers to NULL. */ -hlist_for_each_entry (h, n, &net->ct.unconfirmed, hnode) +hlist_for_each_entry (h, nn, &net->ct.unconfirmed, hnnode)unhelp (h, me);for (i =0 ; i < nf_conntrack_htable_size; i++) { -hlist_for_each_entry (h, n, &net->ct.hash[i], hnode) +hlist_nulls_for_each_entry (h, nn, &net->ct.hash[i], hnnode)unhelp (h, me); } }
@@ -217,7 +218,7 @@ int nf_conntrack_helper_init(void) nf_ct_helper_hsize =1 ;/* gets rounded up to use one page */ nf_ct_helper_hash =nf_ct_alloc_hashtable (&nf_ct_helper_hsize, - &nf_ct_helper_vmalloc); + &nf_ct_helper_vmalloc,0 );if (!nf_ct_helper_hash)return -ENOMEM ;
net/netfilter/nf_conntrack_netlink.c +11 -9
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/rculist.h> +#include <linux/rculist_nulls.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/skbuff.h>
@@ -536,7 +537,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) {struct nf_conn *ct, *last;struct nf_conntrack_tuple_hash *h; -struct hlist_node *n; +struct hlist_nulls_node *n;struct nfgenmsg *nfmsg =NLMSG_DATA (cb->nlh);u_int8_t l3proto = nfmsg->nfgen_family;
@@ -544,27 +545,27 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) last = (struct nf_conn *)cb->args[1 ];for (; cb->args[0 ] < nf_conntrack_htable_size; cb->args[0 ]++) { restart: -hlist_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], - hnode) { +hlist_nulls_for_each_entry_rcu (h, n, &init_net.ct.hash[cb->args[0 ]], + hnnode) {if (NF_CT_DIRECTION (h) !=IP_CT_DIR_ORIGINAL )continue ; ct =nf_ct_tuplehash_to_ctrack (h); +if (!atomic_inc_not_zero (&ct->ct_general.use)) +continue ;/* Dump entries of a given L3 protocol number. * If it is not specified, ie. l3proto == 0, * then dump everything. */ if (l3proto &&nf_ct_l3num (ct) != l3proto) -continue ; + goto releasect;if (cb->args[1 ]) {if (ct != last) -continue ; + goto releasect; cb->args[1 ] =0 ; }if (ctnetlink_fill_info (skb,NETLINK_CB (cb->skb).pid, cb->nlh->nlmsg_seq,IPCTNL_MSG_CT_NEW ,1 , ct) <0 ) { -if (!atomic_inc_not_zero (&ct->ct_general.use)) -continue ; cb->args[1 ] = (unsigned long )ct; goto out; }
@@ -577,6 +578,8 @@ restart:if (acct)memset (acct,0 ,sizeof (struct nf_conn_counter [IP_CT_DIR_MAX ])); } +releasect: +nf_ct_put (ct); }if (cb->args[1 ]) { cb->args[1 ] =0 ;
@@ -1242,13 +1245,12 @@ ctnetlink_create_conntrack(struct nlattr *cda[],if (err <0 ) goto err2; - master_h =__nf_conntrack_find (&init_net, &master); + master_h =nf_conntrack_find_get (&init_net, &master);if (master_h ==NULL ) { err = -ENOENT ; goto err2; } master_ct =nf_ct_tuplehash_to_ctrack (master_h); -nf_conntrack_get (&master_ct->ct_general);__set_bit (IPS_EXPECTED_BIT , &ct->status); ct->master = master_ct; }
net/netfilter/nf_conntrack_standalone.c +33 -24
140 lines not on this page · raw message
net/netfilter/xt_connlimit.c +4 -2
@@ -108,7 +108,7 @@ static int count_them(struct xt_connlimit_data *data,const struct nf_conntrack_tuple_hash *found;struct xt_connlimit_conn *conn;struct xt_connlimit_conn *tmp; -const struct nf_conn *found_ct; +struct nf_conn *found_ct;struct list_head *hash;bool addit = true;int matches =0 ;
@@ -123,7 +123,7 @@ static int count_them(struct xt_connlimit_data *data,/* check the saved connections */ list_for_each_entry_safe (conn, tmp, hash, list) { - found =__nf_conntrack_find (&init_net, &conn->tuple); + found =nf_conntrack_find_get (&init_net, &conn->tuple); found_ct =NULL ;if (found !=NULL )
@@ -151,6 +151,7 @@ static int count_them(struct xt_connlimit_data *data,* we do not care about connections which are * closed already -> ditch it */ +nf_ct_put (found_ct);list_del (&conn->list);kfree (conn);continue ;
@@ -160,6 +161,7 @@ static int count_them(struct xt_connlimit_data *data, match->family))/* same source network -> be counted! */ ++matches; +nf_ct_put (found_ct); }rcu_read_unlock ();
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Patrick McHardy
AppliedRe: [PATCH] conntrack: use SLAB_DESTROY_BY_RCU for nf_conn structs
Quoted 14 lines · Eric Dumazet
Quoted 6 lines · Patrick McHardy
I think double entries are not a problem, as you say, there are already other cases where this can happen. But I think we should try our best that every entry present at the start and still present at the end of a dump is also contained in the dump, otherwise the guantees seem to weak to still be useful. Your first proposal would do exactly that, right?
If your concern is to not forget entries, and we are allowed to print some entries several times, then we can just check the final "nulls" value, and if we find a different value than expected for chain N, go back to begining of chain N.
No need to check hash value (this could help not print several time same entry, we dont care that much)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c struct ct_iter_state { · line 55
Quoted 5 lines
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +5
-0+while (is_a_nulls (head)) { +if (likely (get_nulls_value (head) == st->bucket)) { +if (++st->bucket >= nf_conntrack_htable_size) +return NULL ; + }
Looks perfect :)
Quoted 17 lines
[PATCH] conntrack: use
SLAB_DESTROY_BY_RCUand get rid ofcall_rcu()Use "
hlist_nulls" infrastructure we added in 2.6.29 for RCUification of UDP & TCP.This permits an easy conversion from
call_rcu()based hash lists to aSLAB_DESTROY_BY_RCUone.Avoiding
call_rcu()delay atnf_connfreeing time has numerous gains.First, it doesnt fill RCU queues (up to 10000 elements per cpu). This reduces OOM possibility, if queued elements are not taken into account This reduces latency problems when RCU queue size hits hilimit and triggers emergency mode.
- It allows fast reuse of just freed elements, permitting better use of CPU cache.
Quoted 6 lines
- We delete
rcu_headfrom "structnf_conn", shrinking size of this structure by 8 or 16 bytes.This patch only takes care of "struct
nf_conn".call_rcu()is still used for less critical conntrack parts, that may be converted later if necessary.
Applied, thanks a lot.
Re: [PATCH] conntrack: Reduce conntrack count in nf_conntrack_free()
In reply to Maxime BizonMaxime Bizon <[email protected]> wrote on 24/03/2009 16:17:30:
Quoted 16 lines · Eric Dumazet
Hi Eric,
Quoted 6 lines
We use RCU to defer freeing of conntrack structures. In DOS situation, RCU might accumulate about 10.000 elements per CPU in its internal queues. To get accurate conntrack counts (at the expense of slightly more RAM used), we might consider conntrack counter not taking into account "about to be freed elements, waiting in RCU queues". We thus decrement it in
nf_conntrack_free(), not in the RCU callback.Your patch fixes the problem on my board too (embedded mips router 250Mhz), thanks.
Quoted 6 lines
Yet I'm concerned about what you said concerning RAM usage. I have a very small amount on memory left on my board (less than 4M), and I tuned ip route cache size and
nf_conntrack_maxto make sure I won't go OOM.With your patch, does it mean 10000 conntrack entries can be allocated while
nf_conntrack_maxis say only 2048 ?
Just add "rcuclassic.qhimark=2048" to your cmdline.
Jocke
Quoted 35 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 4 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree as
of
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?Quoted 8 lines
Quoted 4 lines
Quoted 1 line
What does
/proc/net/netfilter/nf_conntrackshow?There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most likely by leaking skbs. Since I haven't seen any other reports, my guess would be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel thread has
stopped
scanning the FS
Quoted 3 lines
Then the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?
How many cpus do you have ?
What kernel version do you use ?
Eric Dumazet <[email protected]> wrote on 23/03/2009 18:49:38:
Quoted 8 lines
Quoted 6 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 4 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree
as
Quoted 11 lines
Quoted 11 lines
of
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel thread
has
Quoted 8 lines
Quoted 6 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?How many cpus do you have ?
Just one, it is an embedded board running at 266 MHz
Quoted 2 lines
What kernel version do you use ?
Linus tree as of Friday
Quoted 44 lines · Joakim Tjernlund
Eric Dumazet <[email protected]> wrote on 23/03/2009 18:49:38:
Quoted 7 lines
Quoted 6 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:29:33:
Quoted 4 lines
Quoted 3 lines · Joakim Tjernlund
Patrick McHardy <[email protected]> wrote on 23/03/2009 13:15:45:
Quoted 2 lines
Quoted 1 line · Joakim Tjernlund
doing a "ping -f -l 3" on my host towards my board on linus tree
as
Quoted 11 lines
Quoted 11 lines
of
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Friday results in lots of:
nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.__ratelimit: 11 callbacks suppressednf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.nf_conntrack: table full, dropping packet.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
for
ucc_gethon a MPC832x.
This really looks strange to me, ideas?What does
/proc/net/netfilter/nf_conntrackshow?There is no
/proc/net/netfilter/nf_conntrack. There is a/proc/net/nf_conntrackthough and it is empty. If I telnet to the board I see:That means that something is leaking conntrack references, most
likely
Quoted 1 line
Quoted 1 line
Quoted 1 line
by leaking skbs. Since I haven't seen any other reports, my guess
would
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
be the
ucc_gethdriver.Mucking around with the
ucc_gethdriver I found that if I:
- Move TX from IRQ to NAPI context
- double the weight.
- after booting up, wait a few mins until the JFFS2 GC kernel threadhas
Quoted 6 lines
Quoted 6 lines
stopped
scanning the FSThen the "
nf_conntrack: table full, dropping packet." msgs stops. Does this seem right to you guys?
Quoted 9 lines
Quoted 1 line
How many cpus do you have ?
Just one, it is an embedded board running at 266 MHz
Quoted 1 line
What kernel version do you use ?
Linus tree as of Friday
I suspect RCU problem. Maybe the GC kernel threads blocks synchronize_rcu() ?