]> git.baikalelectronics.ru Git - kernel.git/commit
netns: get more entropy from net_hash_mix()
authorEric Dumazet <edumazet@google.com>
Fri, 22 Jun 2018 23:27:47 +0000 (16:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Jun 2018 01:59:56 +0000 (10:59 +0900)
commit706b7c83f1b558b628f2a2cd6a34f31b874df12d
treebd28494ae183d0327978152a43a1124dcc71327a
parente6e68ee40754840db2adab3931d2222bd1cea4dc
netns: get more entropy from net_hash_mix()

struct net are effectively allocated from order-1 pages on x86,
with one object per slab, meaning that the 13 low order bits
of their addresses are zero.

Once shifted by L1_CACHE_SHIFT, this leaves 7 zero-bits,
meaning that net_hash_mix() does not help spreading
objects on various hash tables.

For example, TCP listen table has 32 buckets, meaning that
all netns use the same bucket for port 80 or port 443.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netns/hash.h