[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iKDuODR=HasPhEkp6tFFD0-kcU2cZRgWenDr6fsPcziuA@mail.gmail.com>
Date: Thu, 26 Sep 2024 09:42:48 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Alexandre Ferrieux <alexandre.ferrieux@...il.com>
Cc: alexandre.ferrieux@...nge.com, nicolas.dichtel@...nd.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net] ipv4: avoid quadratic behavior in FIB insertion of
common address
On Wed, Sep 25, 2024 at 11:29 PM Alexandre Ferrieux
<alexandre.ferrieux@...il.com> wrote:
>
> Mix netns into all IPv4 FIB hashes to avoid massive collision when
> inserting the same address in many netns.
>
> Signed-off-by: Alexandre Ferrieux <alexandre.ferrieux@...nge.com>
I think this targets net-next tree, which re-opens next week.
> ---
> net/ipv4/fib_semantics.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index ba2df3d2ac15..89fa8fd1a4a5 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -347,10 +347,12 @@ static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope,
> return val;
> }
>
> -static unsigned int fib_info_hashfn_result(unsigned int val)
> +static unsigned int fib_info_hashfn_result(struct net *net, unsigned int val)
This can be 'const struct net *net'
> {
> unsigned int mask = (fib_info_hash_size - 1);
mask can be deleted, see below.
>
> + val ^= net_hash_mix(net);
> +
> return (val ^ (val >> 7) ^ (val >> 12)) & mask;
Please replace this legacy stuff with something more generic :
return hash_32(val ^ net_hash_mix(net), fib_info_hash_bits);
> }
>
> @@ -370,7 +372,7 @@ static inline unsigned int fib_info_hashfn(struct fib_info *fi)
> } endfor_nexthops(fi)
> }
>
Powered by blists - more mailing lists