On Wed, 14 Jan 2026 12:41:50 GMT, Doug Lea <[email protected]> wrote:
>> Changes signal filtering to avoid possible starvation
>
> Doug Lea has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Another set of contend vs deactivate vs park tradeoffs
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1861:
> 1859: break;
> 1860: }
> 1861: }
The following might be a potential alternative encoding of signalWork—it would
be interesting to hear if it makes any difference on your testing array, Doug:
final void signalWork(WorkQueue src, int base) {
int pc = parallelism, i, sp; // rely on caller sync for initial reads
long c = U.getLong(this, CTL);
WorkQueue[] qs;
while ((short)(c >>> RC_SHIFT) < pc && (qs = queues) != null &&
qs.length > (i = (sp = (int)c) & SMASK) && (src == null ||
src.base - base < 1)) {
if (i == 0) {
if ((short)(c >>> TC_SHIFT) >= pc)
break;
if (c == (c = U.compareAndExchangeLong(this, CTL, c, ((c +
TC_UNIT) & TC_MASK) | ((c + RC_UNIT) & RC_MASK)))) {
createWorker();
break;
}
}
else {
WorkQueue v;
if ((v = qs[i]) == null)
break;
if (c == (c = U.compareAndExchangeLong(this, CTL, c,
(v.stackPred & LMASK) | ((c + RC_UNIT) & UMASK)))) {
v.phase = sp;
if (v.parking != 0)
U.unpark(v.owner);
break;
}
}
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28797#discussion_r2694226850