mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
rhashtable: clean up dereference of ->future_tbl.
Using rht_dereference_bucket() to dereference ->future_tbl looks like a type error, and could be confusing. Using rht_dereference_rcu() to test a pointer for NULL adds an unnecessary barrier - rcu_access_pointer() is preferred for NULL tests when no lock is held. This uses 3 different ways to access ->future_tbl. - if we know the mutex is held, use rht_dereference() - if we don't hold the mutex, and are only testing for NULL, use rcu_access_pointer() - otherwise (using RCU protection for true dereference), use rht_dereference_rcu(). Note that this includes a simplification of the call to rhashtable_last_table() - we don't do an extra dereference before the call any more. Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0ad66449aa
commit
c0690016a7
2 changed files with 5 additions and 6 deletions
|
@ -595,7 +595,7 @@ static inline void *__rhashtable_insert_fast(
|
|||
lock = rht_bucket_lock(tbl, hash);
|
||||
spin_lock_bh(lock);
|
||||
|
||||
if (unlikely(rht_dereference_bucket(tbl->future_tbl, tbl, hash))) {
|
||||
if (unlikely(rcu_access_pointer(tbl->future_tbl))) {
|
||||
slow_path:
|
||||
spin_unlock_bh(lock);
|
||||
rcu_read_unlock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue