RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Fri May 10 11:57:13 UTC 2024


On Fri, 10 May 2024 08:11:52 GMT, Viktor Klang <vklang 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 1830:
> 
>> 1828:             phase = w.phase;
>> 1829:             if ((src = w.source) != DROPPED) {
>> 1830:                 w.source = DROPPED;        // else already dropped
> 
> @DougLea Would there be any gain in atomically swapping out `w.source` to `DROPPED`?

No the source field is only written by owner. (With one harmless exception -- cascading idle timeouts, where an invalid value is set to check that no tasks were taken by successor.) I should note this somewhere.

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

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


More information about the core-libs-dev mailing list