Skip to content

Commit 533211a

Browse files
committed
8358621: Reduce busy waiting in worse case at the synchronization point returning from native in CPU Time Profiler
Reviewed-by: shade Backport-of: d2082c5
1 parent 07bb0e3 commit 533211a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hotspot/share/jfr/support/jfrThreadLocal.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "runtime/os.hpp"
4646
#include "runtime/threadIdentifier.hpp"
4747
#include "utilities/sizes.hpp"
48+
#include "utilities/spinYield.hpp"
4849

4950
JfrThreadLocal::JfrThreadLocal() :
5051
_sample_request(),
@@ -600,7 +601,10 @@ bool JfrThreadLocal::try_acquire_cpu_time_jfr_dequeue_lock() {
600601
}
601602

602603
void JfrThreadLocal::acquire_cpu_time_jfr_dequeue_lock() {
603-
while (Atomic::cmpxchg(&_cpu_time_jfr_locked, UNLOCKED, DEQUEUE) != UNLOCKED);
604+
SpinYield s;
605+
while (Atomic::cmpxchg(&_cpu_time_jfr_locked, UNLOCKED, DEQUEUE) != UNLOCKED) {
606+
s.wait();
607+
}
604608
}
605609

606610
void JfrThreadLocal::release_cpu_time_jfr_queue_lock() {

0 commit comments

Comments
 (0)