From: Eric Dumazet <edumazet@google.com>
Date: Sun, 21 Oct 2012 20:12:09 +0000 (+0000)
Subject: ipv4: 16 slots in initial fib_info hash table
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d94ce9b283736a876b2e6dec665c68e5e8b5d55e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

ipv4: 16 slots in initial fib_info hash table

A small host typically needs ~10 fib_info structures, so create initial
hash table with 16 slots instead of only one. This removes potential
false sharing and reallocs/rehashes (1->2->4->8->16)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 71b125cd5db1..4797a800faf8 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -803,7 +803,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
 		unsigned int bytes;
 
 		if (!new_size)
-			new_size = 1;
+			new_size = 16;
 		bytes = new_size * sizeof(struct hlist_head *);
 		new_info_hash = fib_info_hash_alloc(bytes);
 		new_laddrhash = fib_info_hash_alloc(bytes);