aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 919f2ad19b49..3df057e89640 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1016,16 +1016,15 @@ static struct notifier_block fib_netdev_notifier = {
1016static int __net_init ip_fib_net_init(struct net *net) 1016static int __net_init ip_fib_net_init(struct net *net)
1017{ 1017{
1018 int err; 1018 int err;
1019 unsigned int i; 1019 size_t size = sizeof(struct hlist_head) * FIB_TABLE_HASHSZ;
1020
1021 /* Avoid false sharing : Use at least a full cache line */
1022 size = max_t(size_t, size, L1_CACHE_BYTES);
1020 1023
1021 net->ipv4.fib_table_hash = kzalloc( 1024 net->ipv4.fib_table_hash = kzalloc(size, GFP_KERNEL);
1022 sizeof(struct hlist_head)*FIB_TABLE_HASHSZ, GFP_KERNEL);
1023 if (net->ipv4.fib_table_hash == NULL) 1025 if (net->ipv4.fib_table_hash == NULL)
1024 return -ENOMEM; 1026 return -ENOMEM;
1025 1027
1026 for (i = 0; i < FIB_TABLE_HASHSZ; i++)
1027 INIT_HLIST_HEAD(&net->ipv4.fib_table_hash[i]);
1028
1029 err = fib4_rules_init(net); 1028 err = fib4_rules_init(net);
1030 if (err < 0) 1029 if (err < 0)
1031 goto fail; 1030 goto fail;