8080623: CPU overhead in FJ due to spinning in awaitWork
authordl
Wed, 20 May 2015 14:50:57 +0200
changeset 30681 4a3c81f6f384
parent 30680 ddb6897152bf
child 30682 a6f608b9b14d
8080623: CPU overhead in FJ due to spinning in awaitWork Reviewed-by: chegar, dholmes
jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Wed May 20 08:58:14 2015 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Wed May 20 14:50:57 2015 +0200
@@ -1328,13 +1328,16 @@
     /**
      * 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.
+     *
+     * 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.
      */
-    private static final int SPINS  = 1 << 11;
+    private static final int SPINS  = 0;
 
     /**
      * Increment for seed generators. See class ThreadLocal for