On 20/05/2015 8:24 PM, Paul Sandoz wrote:
On May 20, 2015, at 11:46 AM, David Holmes <[email protected]> wrote:
On 20/05/2015 7:28 PM, Paul Sandoz wrote:
On May 20, 2015, at 9:07 AM, David Holmes <[email protected]> wrote:
On 20/05/2015 3:55 AM, Paul Sandoz wrote:
Hi,
https://bugs.openjdk.java.net/browse/JDK-8080623
diff -r ea3ca5cfc3c6
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
Tue May 19 20:04:29 2015 +0300
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
Tue May 19 19:54:00 2015 +0200
@@ -1328,13 +1328,9 @@
/**
* Number of times to spin-wait before blocking. The spins (in
* awaitRunStateLock and awaitWork) currently use randomized
- * spins. If/when MWAIT-like intrinsics becomes available, they
- * may allow quieter spinning. The value of SPINS must be a power
- * of two, at least 4. The current value causes spinning for a
- * small fraction of typical context-switch times, well worthwhile
- * given the typical likelihoods that blocking is not necessary.
+ * spins. Currently set to zero to reduce CPU usage.
I'd keep the commentary even if disabling spinning at this time.
Some of removed commentary makes less sense given the motivation to set the
value to zero. How about the following tweak:
/**
* Number of times to spin-wait before blocking. The spins (in
* awaitRunStateLock and awaitWork) currently use randomized
- * spins. If/when MWAIT-like intrinsics becomes available, they
- * may allow quieter spinning. The value of SPINS must be a power
- * of two, at least 4. The current value causes spinning for a
- * small fraction of typical context-switch times, well worthwhile
- * given the typical likelihoods that blocking is not necessary.
+ * spins. Currently set to zero to reduce CPU usage.
I've lost the context for what "spin" is getting randomized ??
Not sure there was much context to begin with :-) best to look at the
implementation: a spin value, initialized to SPINS, is (if > 0) decremented if
the next value from a PRNG (Marsaglia-like) is non-negative.
Not sure I grok why we would randomize the spin but ...
Thanks,
David
+ *
+ * If greater than zero the value of SPINS must be a power
+ * of two, at least 4. A value of 2048 causes spinning for a
+ * small fraction of typical context-switch times.
+ *
+ * If/when MWAIT-like intrinsics becomes available, they
+ * may allow quieter spinning.
Yep that's fine - thanks.
Thanks,
Paul.