Commit af6e4ad0 authored by David S. Miller's avatar David S. Miller Committed by David S. Miller

[NET]: Neighbour hashing tweaks.

1) Start with a smaller initial hash table size.
   This stresses the new code better.
2) Generate a new hash_rnd every time we grow
   the hashes.

Based upon commentary from Harald Welte.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06e878ef
...@@ -331,6 +331,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries) ...@@ -331,6 +331,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)
old_hash = tbl->hash_buckets; old_hash = tbl->hash_buckets;
write_lock_bh(&tbl->lock); write_lock_bh(&tbl->lock);
get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
for (i = 0; i < old_entries; i++) { for (i = 0; i < old_entries; i++) {
struct neighbour *n, *next; struct neighbour *n, *next;
...@@ -1306,7 +1307,7 @@ void neigh_table_init(struct neigh_table *tbl) ...@@ -1306,7 +1307,7 @@ void neigh_table_init(struct neigh_table *tbl)
if (!tbl->kmem_cachep) if (!tbl->kmem_cachep)
panic("cannot create neighbour cache"); panic("cannot create neighbour cache");
tbl->hash_mask = 0x1f; tbl->hash_mask = 1;
tbl->hash_buckets = neigh_hash_alloc(tbl->hash_mask + 1); tbl->hash_buckets = neigh_hash_alloc(tbl->hash_mask + 1);
phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *); phsize = (PNEIGH_HASHMASK + 1) * sizeof(struct pneigh_entry *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment