On Wed, 4 Jun 2025 11:34:44 GMT, Johannes Bechberger <jbechber...@openjdk.org> wrote:
>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 611: >> >>> 609: // increment the count of active signal handlers >>> 610: u4 old_value = Atomic::fetch_then_add(&_active_signal_handlers, >>> (u4)1, memory_order_acq_rel); >>> 611: if ((old_value & STOP_SIGNAL_BIT) != 0) { >> >> Combining stop signal with a counter is nice, you can then use >> `Atomic::cmpxchg` to avoid incrementing counter when the stop bit is set. > > I don't see how `Atomic::cmpxchg` would make the code easier. With my current code, I avoid having a loop, and in the fast path, I only have one atomic instruction. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126383576