]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: add net_hash_mix() dispersion to fib_info_laddrhash keys
authorEric Dumazet <edumazet@google.com>
Wed, 19 Jan 2022 10:04:13 +0000 (02:04 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Jan 2022 16:14:40 +0000 (08:14 -0800)
commitec6e88aad82c982814ae9595c964eb3c2a8a1692
treee9ad4aa8aa2d54dcb07afe7c0b0fa3b807855d21
parent1c5a1a00fa220555088e00a13874c4fac8951bdb
ipv4: add net_hash_mix() dispersion to fib_info_laddrhash keys

net/ipv4/fib_semantics.c uses a hash table (fib_info_laddrhash)
in which fib_sync_down_addr() can locate fib_info
based on IPv4 local address.

This hash table is resized based on total number of
hashed fib_info, but the hash function is only
using the local address.

For hosts having many active network namespaces,
all fib_info for loopback devices (IPv4 address 127.0.0.1)
are hashed into a single bucket, making netns dismantles
very slow.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/fib_semantics.c