Re: [RFC] rhashtable: rhashtable_rehash
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2015-03-09 10:13:21
Just going through old emails so this may no longer be relevant. On Mon, Feb 02, 2015 at 11:16:47AM +0000, Thomas Graf wrote:
On 01/31/15 at 09:23pm, Herbert Xu wrote:quoted
+ new_hash = head_hashfn(ht, new_tbl, entry); + + new_bucket_lock = bucket_lock(new_tbl, new_hash); + + spin_lock(new_bucket_lock);I realize this is WIP and not fully worked out yet, therefore just a thought: Unless you change this fundamentally then locking just the new bucket lock based on the new hash is not sufficient when you rehash while growing as the old bucket will contain entries which will get distributed across 2 buckets in the new table and if we change the seed it will map to even more buckets. I assume you have an idea how to handle that.
This doesn't matter because we're doing the resize one entry at a time. IOW we're moving one entry from the old table to the new table. The lock is only needed to avoid parallel additions to the same bucket in the new table. Removals will need to scan the old table followed by the new table just like lookups so they don't care. Cheers, -- Email: Herbert Xu [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt