netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] flowcache: Tune per cpu flow cache shrink size
@ 2014-03-14  7:42 Fan Du
  2014-03-14 10:26 ` Steffen Klassert
  2014-03-14 18:43 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Fan Du @ 2014-03-14  7:42 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

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.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/core/flow.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/flow.c b/net/core/flow.c
index 31cfb365e0c6..e379cdcd699b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -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);
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] flowcache: Tune per cpu flow cache shrink size
  2014-03-14  7:42 [PATCH net-next] flowcache: Tune per cpu flow cache shrink size Fan Du
@ 2014-03-14 10:26 ` Steffen Klassert
  2014-03-14 18:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Steffen Klassert @ 2014-03-14 10:26 UTC (permalink / raw)
  To: Fan Du; +Cc: davem, netdev

On Fri, Mar 14, 2014 at 03:42:46PM +0800, Fan Du wrote:
> 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.
> 

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] flowcache: Tune per cpu flow cache shrink size
  2014-03-14  7:42 [PATCH net-next] flowcache: Tune per cpu flow cache shrink size Fan Du
  2014-03-14 10:26 ` Steffen Klassert
@ 2014-03-14 18:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-03-14 18:43 UTC (permalink / raw)
  To: fan.du; +Cc: steffen.klassert, netdev

From: Fan Du <fan.du@windriver.com>
Date: Fri, 14 Mar 2014 15:42:46 +0800

> 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.
> 
> Signed-off-by: Fan Du <fan.du@windriver.com>

We are limiting hash chain lengths, not total hash table size.

Your change is therefore not appropriate.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-14 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14  7:42 [PATCH net-next] flowcache: Tune per cpu flow cache shrink size Fan Du
2014-03-14 10:26 ` Steffen Klassert
2014-03-14 18:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).