Summary
Deprecate the DontYieldALot
flag in JDK 23 and obsolete it in JDK 24, then remove in JDK 25.
Problem
The DontYieldALot
flag was introduced way back in Java 1.0 to address scheduling anomalies on Solaris sparc. Due to uncertainly around scheduling and preemption (ref original "co-operative" "green threads") Java libraries would insert Thread.yield
calls in numerous places to try to be "good citizens". With the thread scheduling model used by Hotspot on Solaris these yield calls were not only unnecessary but became a detriment to performance. To mitigate this "yield throttling" was put in place using the DontYieldALot
product flag and the develop flag DontYieldALotInterval
. If DontYieldALot
was true then yields would become no-ops unless it had been DontYieldALotInterval
milliseconds since the last real yield. The DontYieldALot
flag was only set true on Solaris.
Skip forward 25 years and the library code relies on preemptive scheduling and doesn't use yield very much. We no longer support Solaris and so the flag is always false.
Solution
Deprecate the DontYieldALot
flag in JDK 23 and obsolete it in JDK 24, then remove in JDK 25.
Specification
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
index 1091e4fab25..4bcc3f0a044 100644
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -501,6 +501,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "RegisterFinalizersAtInit", JDK_Version::jdk(22), JDK_Version::jdk(23), JDK_Version::jdk(24) },
+ { "DontYieldALot", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
{ "PreserveAllAnnotations", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
{ "UseNotificationThread", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
{ "UseEmptySlotsInSupers", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 1d23e4164c4..c804e7fc2c1 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -698,7 +698,7 @@ const int ObjectAlignmentInBytes = 8;
"registering as parallel capable") \
\
product_pd(bool, DontYieldALot, \
- "Throw away obvious excess yield calls") \
+ "(Deprecated) Throw away obvious excess yield calls") \
- csr of
-
JDK-8331021 Deprecate and then obsolete the DontYieldALot flag
-
- Resolved
-