RFR: 8360046: Scalability issue when submitting virtual threads with almost empty tasks [v8]

Viktor Klang vklang at openjdk.org
Thu Sep 11 12:35:27 UTC 2025


On Sun, 7 Sep 2025 18:28:54 GMT, Doug Lea <dl at openjdk.org> wrote:

>> This set of updates reduces contention-based performance loss under heavy over-subscription, while also improving perfomance more generally.
>
> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
> 
>   revive topLevelExec, adjust occrdingly; small teaks and copy-edits

src/java.base/share/classes/java/util/concurrent/Exchanger.java line 276:

> 274:     static final class Node {
> 275:         long seed;              // Random seed
> 276:         int index;              // Arena index

Just adding it here as a reminder (to myself if nothing else) that the changes to Exchanger.java should be in a separate PR for easier handling.

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

> 573:      * or non-emptiness; all of which usually cause more activations
> 574:      * than necessary (see below). (Method signalWork is also used as
> 575:      * failsafe in case of Thread failures in deregisterWorker.)

I think it is worth elaborating what this failsafe enables (i.e. how does it failsafe these failures)

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

> 596:      * needs unparking upon signal.
> 597:      *
> 598:      * When tasks are constructed as (recursive) dags, top-level

Suggestion:

     * When tasks are constructed as (recursive) DAGs, top-level

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

> 603:      * empty or contended, while also minimizing interference by
> 604:      * postponing bookeeping to ends of runs. This may reduce
> 605:      * fairness, which is partially counteracted by the following.

This sentence ends in a weird manner for me. Is the intention that the dot should be a colon? Or is there missing text?

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

> 610:      * stalls when tasks cannot be taken because other workers have
> 611:      * not finished poll operations, which is detected by reading
> 612:      * ahead in queue arrays. In both caes, workers restart scans in a

Suggestion:

     * ahead in queue arrays. In both cases, workers restart scans in a

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2340616981
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2340606205
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2340607680
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2340612511
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2340613633


More information about the core-libs-dev mailing list