RFR: 8337789: JEP 509: JFR CPU-Time Profiling (Experimental) [v47]

Zhengyu Gu zgu at openjdk.org
Thu May 8 01:28:00 UTC 2025


On Wed, 7 May 2025 21:31:22 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> It's used in the signal handlers of multiple threads (per thread signals) and at safepoints of all threads in parallel.
>> 
>> Safepoints per thread can happen in parallel. Hope this clarifies it.
>
> Thank you for the explanation.

> @zhengyu123 I don't see how a race you've described can happen. T2 will not reach `cmpxchg` to claim position 0, since an earlier check `if (state == state_empty(tail))` will fail in this case. Note that `state_empty(tail)` will be true for `tail == 1` but not for `tail == 3`. Or am I missing something?

T1:  can be scheduled out of CPU right after CAS, before ` Atomic::release_store(&e->_state, state_full(tail));`, so position 0 is still empty.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20752#discussion_r2078744427


More information about the hotspot-dev mailing list