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

Viktor Klang vklang at openjdk.org
Mon Sep 22 10:58:29 UTC 2025


On Sat, 20 Sep 2025 17:32:31 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:
> 
>   Add @Contended WorkQueue region. Adapt accordingly.

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

> 2028:         int idle = 1;
> 2029:         if (w != null) {                        // always true; hoist checks
> 2030:             int activePhase = (w.phase += IDLE) + IDLE; // advance

This will add IDLE twice to activePhase?

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

> 2032:             do {                                // enqueue
> 2033:                 qc = ap | ((pc - RC_UNIT) & UMASK);
> 2034:                 w.stackPred = (int)pc;          // set ctl stack link

Is it worth updating w.stackPred every time before a failing CAS of pc, qc? Is the intent to flush that change when the CAS succeeds?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2367650760
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2367660166


More information about the core-libs-dev mailing list