RFR: 8337789: JEP 509: JFR CPU-Time Profiling (Experimental) [v47]
Zhengyu Gu
zgu at openjdk.org
Tue May 6 19:53:31 UTC 2025
On Mon, 5 May 2025 14:22:07 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:
>> This is the code for the [JEP draft: CPU Time based profiling for JFR].
>>
>> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests).
>>
>> A version based on the cooperative sampling JEP can be found [here](https://github.com/parttimenerd/jdk/tree/parttimenerd_cooperative_cpu_time_sampler).
>
> 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
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
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20752#discussion_r2076150740
More information about the hotspot-dev
mailing list