From: Liujiaxin <liujiaxin.2...@bytedance.com>

if pre_count less than 10 and n_conn_limit less than CONNTRACK_BUCKETS * 10, 
the limit for sweep_bucket will be 0, so the expired connections in bucket can 
not be clean.

set the minimum limit to 10.

Signed-off-by: Liujiaxin <liujiaxin.2...@bytedance.com>
---
 lib/conntrack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 9eb27ba63..0663c559b 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -1505,7 +1505,8 @@ conntrack_clean(struct conntrack *ct, long long now)
          * the bucket is busier than the others, we limit to 10% of its
          * current size. */
         min_exp = sweep_bucket(ct, ctb, now,
-                MAX(prev_count/10, n_conn_limit/(CONNTRACK_BUCKETS*10)));
+                MAX(10, MAX(prev_count / 10,
+                n_conn_limit / (CONNTRACK_BUCKETS * 10))));
         clean_count += prev_count - hmap_count(&ctb->connections);
 
         if (min_exp > now) {
-- 
2.11.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to