Question about the barrier() in hlist_nulls_for_each_entry_rcu()
From: Alan Huang
Date: Thu Jul 20 2023 - 14:54:18 EST
Hi,
I noticed a commit c87a124a5d5e(“net: force a reload of first item in hlist_nulls_for_each_entry_rcu”)
and a related discussion [1].
After reading the whole discussion, it seems like that ptr->field was cached by gcc even with the deprecated
ACCESS_ONCE(), so my question is:
Is that a compiler bug? If so, has this bug been fixed today, ten years later?
What about READ_ONCE(ptr->field)?
[1] https://lore.kernel.org/all/1369699930.3301.494.camel@edumazet-glaptop/
Thanks,
Alan