News for hackers. Stuff that matters.
Re:What's up with this new memory_order_consume memory order? by jlokier on Wednesday May 24, 2023 @09:09AM (#36057495)
If Consume is discouraged, what should you use instead for the read side of RCU style algorithms?

Acquire is too heavy, and Relaxed is too relaxed, even if it often works on non-Alpha CPUs in practice, it assumes the compiler doesn't get too clever with speculative prefetch and reuse optimisations.

Do we really still need to use Linux's compiler-specific `rcu_dereference` in performant code just because Consume isn't implemented?

Re:What's up with this new memory_order_consume memory order? by bonzini on Wednesday May 24, 2023 @09:23AM (#36057673)
You can use relaxed followed by an acquire compiler fence. Not great but it works.
Re:What's up with this new memory_order_consume memory order? by gpderetta on Wednesday May 24, 2023 @10:37AM (#36058757)
C++ even provides a portable compiler fence in the form atomic_signal_fence.