[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7e1f38c0f792440da38ba0fa96ce932b@baidu.com>
Date: Fri, 30 Jan 2026 11:23:36 +0000
From: "Li,Rongqing" <lirongqing@...du.com>
To: Eric Dumazet <edumazet@...gle.com>
CC: 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>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>, "netfilter-devel@...r.kernel.org"
<netfilter-devel@...r.kernel.org>, "coreteam@...filter.org"
<coreteam@...filter.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] netfilter: conntrack: remove __read_mostly from nf_conntrack_generation
> 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.
Powered by blists - more mailing lists