[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7afac629-e1fd-db4c-5538-d88e74b0ae0b@gmail.com>
Date: Tue, 18 Jan 2022 19:40:38 -0700
From: David Ahern <dsahern@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: David Ahern <dsahern@...nel.org>, netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net 1/2] ipv4: avoid quadratic behavior in netns dismantle
On 1/18/22 1:46 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> net/ipv4/fib_semantics.c uses an hash table of 256 slots,
> keyed by device ifindexes: fib_info_devhash[DEVINDEX_HASHSIZE]
>
> Problem is that with network namespaces, devices tend
> to use the same ifindex.
>
> lo device for instance has a fixed ifindex of one,
> for all network namespaces.
>
> This means that hosts with thousands of netns spend
> a lot of time looking at some hash buckets with thousands
> of elements, notably at netns dismantle.
>
> Simply add a per netns perturbation (net_hash_mix())
> to spread elements more uniformely.
>
> Also change fib_devindex_hashfn() to use more entropy.
>
> Fixes: aa79e66eee5d ("net: Make ifindex generation per-net namespace")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
> net/ipv4/fib_semantics.c | 36 +++++++++++++++++-------------------
> 1 file changed, 17 insertions(+), 19 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists