RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v2]

Viktor Klang vklang at openjdk.org
Sun May 12 19:50:04 UTC 2024


On Sun, 12 May 2024 13:12:24 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
>
> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comments

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

> 990:      */
> 991:     static final int INITIAL_EXTERNAL_QUEUE_CAPACITY = 1 << 9;
> 992:     //        INITIAL_QUEUE_CAPACITY << 2;

Leftover?

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

> 1236:         WorkQueue(ForkJoinWorkerThread owner, int id, int cfg,
> 1237:                   boolean clearThreadLocals) {
> 1238:             array = new ForkJoinTask<?>[owner == null ?

I like this change—initializing the array itself in the WorkQueue constructor makes a lot of sense.

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

> 1240:                                         INITIAL_QUEUE_CAPACITY];
> 1241:             this.owner = owner;
> 1242:             //            top = base = 1;

Leftover?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597703111
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597703016
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1597703079


More information about the core-libs-dev mailing list