Skip to content

Commit

Permalink
rhashtable: Use SINGLE_DEPTH_NESTING
Browse files Browse the repository at this point in the history
We only nest one level deep there is no need to roll our own
subclasses.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Mar 15, 2015
1 parent eddee5b commit 8f2484b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
/* Base bits plus 1 bit for nulls marker */
#define HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)

enum {
RHT_LOCK_NORMAL,
RHT_LOCK_NESTED,
};

/* The bucket lock is selected based on the hash and protects mutations
* on a group of hash buckets.
*
Expand Down Expand Up @@ -231,7 +226,7 @@ static int rhashtable_rehash_one(struct rhashtable *ht, unsigned old_hash)

new_bucket_lock = bucket_lock(new_tbl, new_hash);

spin_lock_nested(new_bucket_lock, RHT_LOCK_NESTED);
spin_lock_nested(new_bucket_lock, SINGLE_DEPTH_NESTING);
head = rht_dereference_bucket(new_tbl->buckets[new_hash],
new_tbl, new_hash);

Expand Down Expand Up @@ -405,7 +400,7 @@ static bool __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj,
tbl = rht_dereference_rcu(ht->future_tbl, ht);
if (tbl != old_tbl) {
hash = head_hashfn(ht, tbl, obj);
spin_lock_nested(bucket_lock(tbl, hash), RHT_LOCK_NESTED);
spin_lock_nested(bucket_lock(tbl, hash), SINGLE_DEPTH_NESTING);
}

if (compare &&
Expand Down

0 comments on commit 8f2484b

Please sign in to comment.