RFR: 8336707: Contention of ForkJoinPool grows when stealing works [v23]
Viktor Klang
vklang at openjdk.org
Mon Nov 11 16:20:05 UTC 2024
On Mon, 11 Nov 2024 16:01:08 GMT, Doug Lea <dl at openjdk.org> wrote:
>> This addresses tendencies in previous update to increase fencing, scanning, and signalling that can increase contention, and slow down performance especially on ARM platforms. It also uses more ARM-friendly constructions to reduce overhead (leading to several changes that all of the same form),
>
> Doug Lea has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge remote-tracking branch 'refs/remotes/origin/JDK-8336707' into JDK-8336707
> - Reconcile internal docs; renamings
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 417:
> 415: * * STOP: no more tasks run, and deregister all workers
> 416: * * CLEANED: all unexecuted tasks have been cancelled
> 417: * * TERMINATED: all qorkers deregistered and all queues cleaned
Suggestion:
* * TERMINATED: all workers deregistered and all queues cleaned
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 663:
> 661: * * A call to shutdownNow, in which case all workers are
> 662: * interrupted. ensuring that the queues array is stable,
> 663: * so will not miss any of them.
Suggestion:
* interrupted, and ensuring that the array of queues is stable,
* so will not miss any of them.
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 676:
> 674: * cancel (benefitting from parallelism) versus contention and
> 675: * interference when many threads try to poll remaining queues,
> 676: * while also avoiding unnecessary rechedcks, by using
Suggestion:
* while also avoiding unnecessary rechecks, by using
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 688:
> 686: * before executing task bodies, and ensures interrupts while
> 687: * terminating. Even so, there are no guarantees because tasks may
> 688: * internally enter unbounded loops.
Good point to make
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 874:
> 872: * cancellation by others, which can occur along several different
> 873: * paths. The inability to rely on caller-runs may also require
> 874: * extra signalling (and resulting scanning and contention) so is
Suggestion:
* extra signalling (resulting in increased scanning and contention) so is
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21507#discussion_r1836899379
PR Review Comment: https://git.openjdk.org/jdk/pull/21507#discussion_r1836903791
PR Review Comment: https://git.openjdk.org/jdk/pull/21507#discussion_r1836908015
PR Review Comment: https://git.openjdk.org/jdk/pull/21507#discussion_r1836908858
PR Review Comment: https://git.openjdk.org/jdk/pull/21507#discussion_r1836910984
More information about the core-libs-dev
mailing list