All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nf_conncount: increase connection clean up limit to 64
@ 2025-12-16 12:24 Fernando Fernandez Mancera
  2025-12-16 12:44 ` Rukomoinikova Aleksandra
  2025-12-16 13:38 ` Florian Westphal
  0 siblings, 2 replies; 9+ messages in thread
From: Fernando Fernandez Mancera @ 2025-12-16 12:24 UTC (permalink / raw)
  To: netfilter-devel
  Cc: coreteam, Fernando Fernandez Mancera, Aleksandra Rukomoinikova

After the optimization to only perform one GC per jiffy, a new problem
was introduced. If more than 8 new connections are tracked per jiffy the
list won't be cleaned up fast enough possibly reaching the limit
wrongly.

In order to prevent this issue, increase the clean up limit to 64
connections so it is easier for conncount to keep up with the new
connections tracked per jiffy rate.

Fixes: d265929930e2 ("netfilter: nf_conncount: reduce unnecessary GC")
Reported-by: Aleksandra Rukomoinikova <ARukomoinikova@k2.cloud>
Closes: https://lore.kernel.org/netfilter/b2064e7b-0776-4e14-adb6-c68080987471@k2.cloud/
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
---
 net/netfilter/nf_conncount.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 3654f1e8976c..ec134729856f 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -34,8 +34,9 @@
 
 #define CONNCOUNT_SLOTS		256U
 
-#define CONNCOUNT_GC_MAX_NODES	8
-#define MAX_KEYLEN		5
+#define CONNCOUNT_GC_MAX_NODES		8
+#define CONNCOUNT_GC_MAX_COLLECT	64
+#define MAX_KEYLEN			5
 
 /* we will save the tuples of all connections we care about */
 struct nf_conncount_tuple {
@@ -187,7 +188,7 @@ static int __nf_conncount_add(struct net *net,
 
 	/* check the saved connections */
 	list_for_each_entry_safe(conn, conn_n, &list->head, node) {
-		if (collect > CONNCOUNT_GC_MAX_NODES)
+		if (collect > CONNCOUNT_GC_MAX_COLLECT)
 			break;
 
 		found = find_or_evict(net, list, conn);
@@ -316,7 +317,7 @@ static bool __nf_conncount_gc_list(struct net *net,
 		}
 
 		nf_ct_put(found_ct);
-		if (collected > CONNCOUNT_GC_MAX_NODES)
+		if (collected > CONNCOUNT_GC_MAX_COLLECT)
 			break;
 	}
 
-- 
2.51.1


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

end of thread, other threads:[~2025-12-16 16:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 12:24 [PATCH nf] netfilter: nf_conncount: increase connection clean up limit to 64 Fernando Fernandez Mancera
2025-12-16 12:44 ` Rukomoinikova Aleksandra
2025-12-16 13:07   ` Fernando Fernandez Mancera
2025-12-16 13:16     ` Rukomoinikova Aleksandra
2025-12-16 13:38 ` Florian Westphal
2025-12-16 15:09   ` Fernando Fernandez Mancera
2025-12-16 15:25     ` Florian Westphal
2025-12-16 15:48       ` Fernando Fernandez Mancera
2025-12-16 16:06         ` Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.