summaryrefslogtreecommitdiffstats
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
authorHerbert Xu2015-03-14 03:57:24 +0100
committerDavid S. Miller2015-03-15 06:35:34 +0100
commit63d512d0cffcae40505d9448abd509972465e846 (patch)
tree61aa0d3763daf884a089e41f8f0f7b829b9357c4 /lib/rhashtable.c
parentrhashtable: Free bucket tables asynchronously after rehash (diff)
downloadkernel-qcow2-linux-63d512d0cffcae40505d9448abd509972465e846.tar.gz
kernel-qcow2-linux-63d512d0cffcae40505d9448abd509972465e846.tar.xz
kernel-qcow2-linux-63d512d0cffcae40505d9448abd509972465e846.zip
rhashtable: Add rehash counter to bucket_table
This patch adds a rehash counter to bucket_table to indicate the last bucket that has been rehashed. This serves two purposes: 1. Any bucket that has been rehashed can never gain a new object. 2. If the rehash counter reaches the size of the table, the table will forever remain empty. This patch also downsizes bucket_table->size to an unsigned int since we do not support sizes greater than 32 bits yet. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 36fb0910bec2..ff4ea1704546 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -260,6 +260,7 @@ static void rhashtable_rehash_chain(struct rhashtable *ht, unsigned old_hash)
spin_lock_bh(old_bucket_lock);
while (!rhashtable_rehash_one(ht, old_hash))
;
+ old_tbl->rehash++;
spin_unlock_bh(old_bucket_lock);
}