RFR: 8337789: JEP 509: JFR CPU-Time Profiling (Experimental) [v47]
Andrei Pangin
apangin at openjdk.org
Thu May 8 01:40:01 UTC 2025
On Thu, 8 May 2025 01:25:16 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
>> 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.
Note that "is-empty" is not a binary flag in this algorithm. Empty state is assigned to a specific position of tail.
Position 0 is marked empty for tail == 0, but not for tail == 2.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20752#discussion_r2078752121
More information about the hotspot-dev
mailing list