mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
fib: avoid false sharing on fib_table_hash
While doing profile analysis, I found fib_hash_table was sometime in a cache line shared by a possibly often written kernel structure. (CONFIG_IP_ROUTE_MULTIPATH || !CONFIG_IPV6_MULTIPLE_TABLES) It's hard to detect because not easily reproductible. Make sure we allocate a full cache line to keep this shared in all cpus caches. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
874ffa8f72
commit
10da66f755
2 changed files with 11 additions and 9 deletions
|
|
@ -1500,15 +1500,18 @@ static void fib6_gc_timer_cb(unsigned long arg)
|
|||
|
||||
static int __net_init fib6_net_init(struct net *net)
|
||||
{
|
||||
size_t size = sizeof(struct hlist_head) * FIB6_TABLE_HASHSZ;
|
||||
|
||||
setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net);
|
||||
|
||||
net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL);
|
||||
if (!net->ipv6.rt6_stats)
|
||||
goto out_timer;
|
||||
|
||||
net->ipv6.fib_table_hash = kcalloc(FIB6_TABLE_HASHSZ,
|
||||
sizeof(*net->ipv6.fib_table_hash),
|
||||
GFP_KERNEL);
|
||||
/* Avoid false sharing : Use at least a full cache line */
|
||||
size = max_t(size_t, size, L1_CACHE_BYTES);
|
||||
|
||||
net->ipv6.fib_table_hash = kzalloc(size, GFP_KERNEL);
|
||||
if (!net->ipv6.fib_table_hash)
|
||||
goto out_rt6_stats;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue