From: "Li,Rongqing" <lirongqing@baidu.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
"netfilter-devel@vger.kernel.org"
<netfilter-devel@vger.kernel.org>,
"coreteam@netfilter.org" <coreteam@netfilter.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] netfilter: conntrack: remove __read_mostly from nf_conntrack_generation
Date: Fri, 30 Jan 2026 11:23:36 +0000 [thread overview]
Message-ID: <7e1f38c0f792440da38ba0fa96ce932b@baidu.com> (raw)
In-Reply-To: <CANn89iLetxqpxpSBpQztPcg=av38nGNr2VpOo7HARrbqubREyg@mail.gmail.com>
> What about nf_conntrack_hash_rnd ?
>
> I _think_ this needs to be __read_mostly, regardless of its current location (it
> might by accident share a mostly read cache line), especially if your patch puts
> nf_conntrack_generation in the same cache line than nf_conntrack_hash_rnd.
>
> Same remark for nf_ct_expect_hashrnd
>
You are right, nf_conntrack_hash_rnd and nf_ct_expect_hashrnd should be marked as __read_mostly
Thanks
-Li
> diff --git a/net/netfilter/nf_conntrack_core.c
> b/net/netfilter/nf_conntrack_core.c
> index
> d1f8eb725d4223e042b02ab86ba89b9b7caf75f5..0a705fab2bb73f7590647ff06d
> 7066395e6eea66
> 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -204,8 +204,8 @@ 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; -static
> siphash_aligned_key_t nf_conntrack_hash_rnd;
> +seqcount_spinlock_t nf_conntrack_generation; static
> +siphash_aligned_key_t nf_conntrack_hash_rnd __read_mostly;
>
> static u32 hash_conntrack_raw(const struct nf_conntrack_tuple *tuple,
> unsigned int zoneid, diff --git
> a/net/netfilter/nf_conntrack_expect.c
> b/net/netfilter/nf_conntrack_expect.c
> index
> cfc2daa3fc7f340937898b4bef0769fd31f801b5..4dae405527febf913af43c49ddb
> 2961a8f05e0e4
> 100644
> --- a/net/netfilter/nf_conntrack_expect.c
> +++ b/net/netfilter/nf_conntrack_expect.c
> @@ -41,7 +41,7 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_hash);
> unsigned int nf_ct_expect_max __read_mostly;
>
> static struct kmem_cache *nf_ct_expect_cachep __read_mostly; -static
> siphash_aligned_key_t nf_ct_expect_hashrnd;
> +static siphash_aligned_key_t nf_ct_expect_hashrnd __read_mostly;
>
> /* nf_conntrack_expect helper functions */ void
> nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
>
> Thanks.
prev parent reply other threads:[~2026-01-30 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 4:43 [PATCH] netfilter: conntrack: remove __read_mostly from nf_conntrack_generation lirongqing
2026-01-30 10:32 ` Eric Dumazet
2026-01-30 11:23 ` Li,Rongqing [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e1f38c0f792440da38ba0fa96ce932b@baidu.com \
--to=lirongqing@baidu.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox