netfilter: conntrack: document sparse hash table eviction
Subsystems (3)
PATCH 1/1 netfilter: conntrack: document sparse hash table eviction
When nf_conntrack_max is significantly smaller than nf_conntrack_buckets, the hash table can become sparsely populated.
The early_drop() path examines at most 8 consecutive hash buckets when searching for eviction candidates. Under table exhaustion, this bounded search may fail to find an eligible entry even when evictable connections exist elsewhere in the table.
Document this limitation to clarify the implications of configuring nf_conntrack_max significantly below nf_conntrack_buckets.
--- Documentation/networking/nf_conntrack-sysctl.rst | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/networking/nf_conntrack-sysctl.rst +4 -0
@@ -99,6 +99,10 @@ nf_conntrack_max - INTEGER the reversed address). This means that with default settings a maxed-out table will have a average hash chain length of 2, not 1. + Setting nf_conntrack_max much lower than nf_conntrack_buckets + may cause early eviction to fail under table exhaustion, as + the eviction search may not find entries in sparse hash tables. + nf_conntrack_tcp_be_liberal - BOOLEAN - 0 - disabled (default) - not 0 - enabled
Signature · 1 line
2.34.1
Pablo Neira Ayuso
maintainerQuoted 21 lines · Vikash SS
When
nf_conntrack_maxis significantly smaller thannf_conntrack_buckets, the hash table can become sparsely populated.The
early_drop()path examines at most 8 consecutive hash buckets when searching for eviction candidates. Under table exhaustion, this bounded search may fail to find an eligible entry even when evictable connections exist elsewhere in the table.Document this limitation to clarify the implications of configuring
nf_conntrack_maxsignificantly belownf_conntrack_buckets.Signed-off-by Vikash SS <[email protected]>--- Documentation/networking/nf_conntrack-sysctl.rst | 4 ++++ 1 file changed, 4 insertions(+)Documentation/networking/nf_conntrack-sysctl.rst +0
-0
Documentation/networking/nf_conntrack-sysctl.rst nf_conntrack_max - INTEGER · line 104
Quoted 6 lines
Documentation/networking/nf_conntrack-sysctl.rst +3
-0@@ -99,6 +99,10 @@ nf_conntrack_max - INTEGER the reversed address). This means that with default settings a maxed-out table will have a average hash chain length of 2, not 1. + Setting nf_conntrack_max much lower than nf_conntrack_buckets + may cause early eviction to fail under table exhaustion, as + the eviction search may not find entries in sparse hash tables.
Maybe provide a positive hint:
+ Make sure nf_conntrack_max is equal to or larger than + nf_conntrack_buckets, otherwise early drop may fail to evict + entries when it gets full.
Quoted 6 lines
Documentation/networking/nf_conntrack-sysctl.rst +0
-0nf_conntrack_tcp_be_liberal - BOOLEAN - 0 - disabled (default) - not 0 - enabledSignature · 1 line
2.34.1
PATCH v2 1/1 netfilter: conntrack: document sparse hash table eviction
In reply to Vikash SSWhen nf_conntrack_max is significantly smaller than nf_conntrack_buckets, the hash table can become sparsely populated.
The early_drop() path examines at most 8 consecutive hash buckets when searching for eviction candidates. Under table exhaustion, this bounded search may fail to find an eligible entry even when evictable connections exist elsewhere in the table.
Document this limitation to clarify the implications of configuring nf_conntrack_max significantly below nf_conntrack_buckets.
---
Changes in v2:
- Reword documentation to provide configuration guidance, as suggested by Pablo Neira Ayuso.
Documentation/networking/nf_conntrack-sysctl.rst | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/networking/nf_conntrack-sysctl.rst +4 -0
@@ -99,6 +99,10 @@ nf_conntrack_max - INTEGER the reversed address). This means that with default settings a maxed-out table will have a average hash chain length of 2, not 1. + Make sure nf_conntrack_max is equal to or larger than + nf_conntrack_buckets, otherwise early drop may fail to evict + entries when it gets full. + nf_conntrack_tcp_be_liberal - BOOLEAN - 0 - disabled (default) - not 0 - enabled
Signature · 1 line
2.34.1
Hi Pablo,
Just following up on the v2 patch submitted on November 6, which incorporates your suggested wording.
Would you have any further comments, or is there anything else needed from my side?
Quoted 49 lines · ss vikash
Hi Pablo,
Just following up on the v2 patch submitted on November 6, which incorporates your suggested wording.
Would you have any further comments, or is there anything else needed from my side?
Quoted 39 lines · Vikash SS
When
nf_conntrack_maxis significantly smaller thannf_conntrack_buckets, the hash table can become sparsely populated.The
early_drop()path examines at most 8 consecutive hash buckets when searching for eviction candidates. Under table exhaustion, this bounded search may fail to find an eligible entry even when evictable connections exist elsewhere in the table.Document this limitation to clarify the implications of configuring
nf_conntrack_maxsignificantly belownf_conntrack_buckets.Signed-off-by Vikash SS <[email protected]>---
Changes in v2:
- Reword documentation to provide configuration guidance, as suggested by Pablo Neira Ayuso.Documentation/networking/nf_conntrack-sysctl.rst | 4 ++++ 1 file changed, 4 insertions(+)Documentation/networking/nf_conntrack-sysctl.rst +4
-1@@ -99,6 +99,10 @@ nf_conntrack_max - INTEGER the reversed address). This means that with default settings a maxed-out table will have a average hash chain length of 2, not 1. + Make sure nf_conntrack_max is equal to or larger than + nf_conntrack_buckets, otherwise early drop may fail to evict + entries when it gets full. + nf_conntrack_tcp_be_liberal - BOOLEAN - 0 - disabled (default) - not 0 - enabled --2.34.1