RFR: 8355627: Don't use ThreadCritical for EventLog list [v2]

Martin Doerr mdoerr at openjdk.org
Mon May 5 13:26:52 UTC 2025


On Mon, 5 May 2025 13:12:18 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> Looks like a Release-Consume pattern: https://en.cppreference.com/w/cpp/atomic/memory_order#Release-Consume_ordering
>> I think it is very likely that it works as it is. Not sure if Atomic::load is 100% safe for this.
>
> `memory_order_conservative` is [Strong two-way memory barrier](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/atomic.hpp#L47), that means all reads and writes *cannot* float pass the barrier.
> 
> If `Atomic::load()` observes a store by conservative order, then precedent reads and writes of the store must have completed.

First of all, nothing on the writer's side can fix the reader's side.

We're basically relying on volatile load + dependency chain on the reader's side. This is very likely to work, but C++ memory model specialists may find this questionable.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24954#discussion_r2073442756


More information about the hotspot-dev mailing list