mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 03:33:59 +08:00
5424ea2739
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>
18 lines
299 B
C
18 lines
299 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NET_NS_HASH_H__
|
|
#define __NET_NS_HASH_H__
|
|
|
|
#include <asm/cache.h>
|
|
|
|
struct net;
|
|
|
|
static inline u32 net_hash_mix(const struct net *net)
|
|
{
|
|
#ifdef CONFIG_NET_NS
|
|
return (u32)(((unsigned long)net) >> ilog2(sizeof(*net)));
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
#endif
|