[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260130044348.3095-1-lirongqing@baidu.com>
Date: Thu, 29 Jan 2026 23:43:48 -0500
From: lirongqing <lirongqing@...du.com>
To: Pablo Neira Ayuso <pablo@...filter.org>, Jozsef Kadlecsik
<kadlec@...filter.org>, Florian Westphal <fw@...len.de>, Phil Sutter
<phil@....cc>, "David S . Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
<netfilter-devel@...r.kernel.org>, <coreteam@...filter.org>,
<netdev@...r.kernel.org>
CC: Li RongQing <lirongqing@...du.com>
Subject: [PATCH] netfilter: conntrack: remove __read_mostly from nf_conntrack_generation
From: Li RongQing <lirongqing@...du.com>
The nf_conntrack_generation sequence counter is updated whenever
conntrack table generations are bumped (e.g., during netns exit or
heavy garbage collection). Under certain workloads, these updates
can be frequent enough that the variable no longer fits the
"read-mostly" criteria.
Applying __read_mostly to a variable that is updated regularly can
lead to cache line bouncing and performance degradation for other
variables residing in the same section. Remove the annotation to
let the variable reside in the standard data section.
Signed-off-by: Li RongQing <lirongqing@...du.com>
---
net/netfilter/nf_conntrack_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index d1f8eb7..233a281 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_htable_size);
unsigned int nf_conntrack_max __read_mostly;
EXPORT_SYMBOL_GPL(nf_conntrack_max);
-seqcount_spinlock_t nf_conntrack_generation __read_mostly;
+seqcount_spinlock_t nf_conntrack_generation;
static siphash_aligned_key_t nf_conntrack_hash_rnd;
static u32 hash_conntrack_raw(const struct nf_conntrack_tuple *tuple,
--
2.9.4
Powered by blists - more mailing lists