All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: nf_conncount: make number of hash slots configurable
@ 2026-04-13 12:37 Vladimir Vdovin
  2026-04-13 13:27 ` Fernando Fernandez Mancera
  2026-04-13 14:26 ` Florian Westphal
  0 siblings, 2 replies; 8+ messages in thread
From: Vladimir Vdovin @ 2026-04-13 12:37 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Vladimir Vdovin, pablo, fw, coreteam, phil

Some workloads with high conntrack rate
generate high lock contention on insert_tree(), so
constant 256 CONNCOUNT_SLOTS can be too small.

Signed-off-by: Vladimir Vdovin <deliran@verdict.gg>
---
 net/netfilter/Kconfig        | 12 ++++++++++++
 net/netfilter/nf_conncount.c |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 6cdc994fdc8a..38df2829d4d6 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -111,6 +111,18 @@ if NF_CONNTRACK
 config NETFILTER_CONNCOUNT
 	tristate
 
+config NF_CONNCOUNT_SLOTS
+	int "Number of hash slots for nf_conncount"
+	depends on NF_CONNTRACK
+	default 256
+	range 1 4096
+	help
+	  Number of hash slots used by the nf_conncount module.
+	  Each slot has its own spinlock and rb-tree, so increasing
+	  this value reduces lock contention at the cost of additional
+	  memory.
+	  Default is 256. Allowed range: 1 - 4096.
+
 config NF_CONNTRACK_MARK
 	bool  'Connection mark tracking support'
 	depends on NETFILTER_ADVANCED
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 00eed5b4d1b1..bdb9081a6c05 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -32,7 +32,7 @@
 #include <net/netfilter/nf_conntrack_tuple.h>
 #include <net/netfilter/nf_conntrack_zones.h>
 
-#define CONNCOUNT_SLOTS		256U
+#define CONNCOUNT_SLOTS		CONFIG_NF_CONNCOUNT_SLOTS
 
 #define CONNCOUNT_GC_MAX_NODES		8
 #define CONNCOUNT_GC_MAX_COLLECT	64

base-commit: 028ef9c96e96197026887c0f092424679298aae8
-- 
2.47.0


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

end of thread, other threads:[~2026-04-15 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13 12:37 [PATCH nf-next] netfilter: nf_conncount: make number of hash slots configurable Vladimir Vdovin
2026-04-13 13:27 ` Fernando Fernandez Mancera
2026-04-15 13:29   ` Vladimir Vdovin
2026-04-13 14:26 ` Florian Westphal
2026-04-15 13:32   ` Vladimir Vdovin
2026-04-15 13:44     ` Florian Westphal
2026-04-15 14:10       ` Vladimir Vdovin
2026-04-15 14:43       ` 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.