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

Johannes Bechberger jbechberger at openjdk.org
Tue May 6 20:30:34 UTC 2025


On Tue, 6 May 2025 19:50:19 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Simplify local trace stack
>
> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 331:
> 
>> 329:       u4 state = Atomic::load_acquire(&e->_state);
>> 330:       if (state == state_empty(tail)) {
>> 331:         if (Atomic::cmpxchg(&_tail, tail, tail + 1, memory_order_seq_cst) == tail) {
> 
> I think it still has race. 
> 
> For example, _tail = 0, _capacity = 2 and queue is empty
> T1 enqueue: claim position 0,  _tail = 1 after CAS
> T2 enqueue: claim position 1,  _tail = 2 after CAS
> T2 enqueue: store value at position 1
> T2 enqueue: claim position 0, _tail = 3 after CAS
> T2 enqueue: store value at position 0
> T1 enqueue: store value at position 0

Could you help with solving this issue?

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

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


More information about the hotspot-dev mailing list