RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Viktor Klang vklang at openjdk.org
Sat May 11 23:57:03 UTC 2024


On Tue, 7 May 2024 22:50:18 GMT, Doug Lea <dl at openjdk.org> wrote:

> This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2074:

> 2072:                 WorkQueue[] qs;
> 2073:                 int spins = ac + ((short)(qc >>> TC_SHIFT) << 1) + SPIN_WAITS;
> 2074:                 while (((p = w.phase) & IDLE) != 0 && --spins != 0)

Might be worth checking `--spins >= 0` to avoid some pathological case where SPIN_WAITS is set to 0?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597523616


More information about the core-libs-dev mailing list