RFR: 8322732: ForkJoinPool may underutilize cores in async mode [v7]
Doug Lea
dl at openjdk.org
Wed May 29 14:49:08 UTC 2024
On Wed, 29 May 2024 13:26:10 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Doug Lea has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 41 additional commits since the last revision:
>>
>> - Merge branch 'openjdk:master' into JDK-8322732
>> - Add test for utilization with interdependent tasks
>> - Un-misplace onSpinWait call
>> - Adjust control flow
>> - Reduce memory stalls
>> - Merge branch 'openjdk:master' into JDK-8322732
>> - More performance tradoffs
>> - Address review comments
>> - Merge branch 'openjdk:master' into JDK-8322732
>> - Repack some fields; adjust control flow
>> - ... and 31 more: https://git.openjdk.org/jdk/compare/c056aa9c...cf5fe55c
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 912:
>
>> 910: * enough to avoid resizing in most tree-structured tasks, but
>> 911: * larger for external queues where both false-sharing problems
>> 912: * and the need for resizing are more common.. (Maintenance note:
>
> Suggestion:
>
> * and the need for resizing are more common. (Maintenance note:
thanks, done.
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1857:
>
>> 1855: (LMASK & c)))));
>> 1856: }
>> 1857: if ((tryTerminate(false, false) & STOP) == 0 && w != null) {
>
> Suggestion:
>
> if ((tryTerminate(false, false) & STOP) == 0L && w != null) {
yes.
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2061:
>
>> 2059: w.stackPred = (int)pc; // set ctl stack link
>> 2060: qc = (active & LMASK) | ((pc - RC_UNIT) & UMASK);
>> 2061: if (pc == (pc = compareAndExchangeCtl(pc, qc)))
>
> If I'm reading this right you might want to add a comment :)
>
> Suggestion:
>
> if (pc == (pc = compareAndExchangeCtl(pc, qc))) // consistent
thanks, done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1619023295
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1619024417
PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1619025818
More information about the core-libs-dev
mailing list