diff mbox

rhashtable: Remove unnecessary wmb for future_tbl

Message ID 20151208090904.GA17605@gondor.apana.org.au
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Herbert Xu Dec. 8, 2015, 9:09 a.m. UTC
The patch 9497df88ab5567daa001829051c5f87161a81ff0 ("rhashtable:
Fix reader/rehash race") added a pair of barriers.  In fact the
wmb is superfluous because every subsequent write to the old or
new hash table uses rcu_assign_pointer, which itself carriers a
full barrier prior to the assignment.

Therefore we may remove the explicit wmb.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Comments

Thomas Graf Dec. 9, 2015, 2:52 a.m. UTC | #1
On 12/08/15 at 05:09pm, Herbert Xu wrote:
> The patch 9497df88ab5567daa001829051c5f87161a81ff0 ("rhashtable:
> Fix reader/rehash race") added a pair of barriers.  In fact the
> wmb is superfluous because every subsequent write to the old or
> new hash table uses rcu_assign_pointer, which itself carriers a
> full barrier prior to the assignment.
> 
> Therefore we may remove the explicit wmb.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

The RELEASE which is now in place afterwards act as a wmb as well,
we are well protected ;-)

Acked-by: Thomas Graf <tgraf@suug.ch>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 9, 2015, 3:47 a.m. UTC | #2
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Tue, 8 Dec 2015 17:09:04 +0800

> The patch 9497df88ab5567daa001829051c5f87161a81ff0 ("rhashtable:
> Fix reader/rehash race") added a pair of barriers.  In fact the
> wmb is superfluous because every subsequent write to the old or
> new hash table uses rcu_assign_pointer, which itself carriers a
> full barrier prior to the assignment.
> 
> Therefore we may remove the explicit wmb.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied to net-next.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 1c624db..d1f94b4 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -232,9 +232,6 @@  static int rhashtable_rehash_attach(struct rhashtable *ht,
 	 */
 	rcu_assign_pointer(old_tbl->future_tbl, new_tbl);
 
-	/* Ensure the new table is visible to readers. */
-	smp_wmb();
-
 	spin_unlock_bh(old_tbl->locks);
 
 	return 0;