On Mon, 2 Jun 2025 21:53:38 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 117: >> >>> 115: >>> 116: bool JfrCPUTimeTraceQueue::is_empty() const { >>> 117: return Atomic::load(&_head) == 0; >> >> Not entirely clear what is the memory semantics for accessing `_head`. Does >> it need to be acq/rel? If so, this one should be `::load_acquire`? > > Many of the accesses to head do not appear to synchronize with anything and > so do not need acquire semantics. But the overall concurrency properties of > this code are very unclear to me. To be clear, you only need acquire semantics here if after seeing the value 0 you need to access fields that were written before `_head` was set to 0. Similarly for most of the other access to `_head`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122374152