Thread (13 messages) 13 messages, 3 authors, 2018-12-03

Re: [PATCH] rhashtable: detect when object movement between tables might have invalidated a lookup

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2018-11-19 03:56:44
Also in: lkml

On Mon, Nov 19, 2018 at 11:54:15AM +0800, Herbert Xu wrote:
quoted
quoted
quoted
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 30526afa8343..852ffa5160f1 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -1179,8 +1179,7 @@ struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
 					    unsigned int hash)
 {
 	const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *));
-	static struct rhash_head __rcu *rhnull =
-		(struct rhash_head __rcu *)NULLS_MARKER(0);
+	static struct rhash_head __rcu *rhnull;
I don't understand why you can't continue to do NULLS_MARKER(0) or
RHT_NULLS_MARKER(0).
Because then the test

+	} while (he != RHT_NULLS_MARKER(head));

in __rhashtable_lookup() would always succeed, and it would loop
forever.
This change is only necessary because of your shifting change
above, which AFAICS adds no real benefit.
I take that back.  Because of your shift which cancels out the
shift in NULLS_MARKER, it would appear that this should work just
fine with RHT_NULLS_MARRKER(0), no? IOW, it would appear that

	RHT_NULLS_MARKER(0) = RHT_NULLS_MARKER(RHT_NULLS_MARKER(0))

Thanks,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help