Patchwork [net-next] ipv4: 16 slots in initial fib_info hash table

login
register
mail settings
Submitter Eric Dumazet
Date Oct. 22, 2012, 6:12 a.m.
Message ID <1350886329.8609.276.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/193079/
State Accepted
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Oct. 22, 2012, 6:12 a.m.
From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv4/fib_semantics.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Oct. 22, 2012, 7:11 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 22 Oct 2012 08:12:09 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 71b125c..4797a80 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);