flowcache: Tune per cpu flow cache shrink size
Subsystems (2)
PATCH 1/1 flowcache: Tune per cpu flow cache shrink size
When per cpu flow cache entries count reaches over high_watermark, flow cache will be shrinked gently to around low_watermark, not brutally killing most of cached entries by left only two.
--- net/core/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow.c +1 -1
@@ -142,7 +142,7 @@ static void __flow_cache_shrink(struct flow_cache *fc,static void flow_cache_shrink (struct flow_cache *fc,struct flow_cache_percpu *fcp) { -int shrink_to = fc->low_watermark /flow_cache_hash_size (fc); +int shrink_to = fc->low_watermark;__flow_cache_shrink (fc, fcp, shrink_to); }
Signature · 1 line
1.7.9.5
Quoted 4 lines · Fan Du
When per cpu flow cache entries count reaches over
high_watermark, flow cache will be shrinked gently to aroundlow_watermark, not brutally killing most of cached entries by left only two.
We currently keep two entries per hash bucket, this means that we keep low_watermark entries at most in the flow cache.
With your change, we would keep low_watermark entries per hash bucket. The flow cache would grow to low_watermark * flow_cache_hash_size then. This would make DoS attacks against the flow cache quite easy.
David Miller
maintainerFrom: Fan Du <[email protected]>
Date: Fri, 14 Mar 2014 15:42:46 +0800
Quoted 5 lines
When per cpu flow cache entries count reaches over
high_watermark, flow cache will be shrinked gently to aroundlow_watermark, not brutally killing most of cached entries by left only two.Signed-off-by Fan Du <[email protected]>
We are limiting hash chain lengths, not total hash table size.
Your change is therefore not appropriate.