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 1267:
> 1265: pool.signalWork(this, s); // may have appeared empty
> 1266: }
> 1267: }
Not sure if it helps in practice, but we could elide the getReferenceAcquire in
certain cases while still ensuring that its performed prior to the unlock with
something like:
final void push(ForkJoinTask<?> task, ForkJoinPool pool, int unlock) {
ForkJoinTask<?>[] a = array;
int b = base, s = top, cap, m;
if (a == null || (cap = a.length) <= s + 1 - b || (m = cap - 1) < 0)
growAndPush(task, pool, unlock);
else {
top = s + 1;
U.getAndSetReference(a, slotOffset(m & s), task);
if (pool != null && U.getReferenceAcquire(a, slotOffset(m & (s
- 1))) == null)
pool = null;
if (unlock != 1) { // release external lock
U.putInt(this, PHASE, unlock);
U.storeFence();
}
if (pool != null)
pool.signalWork(this, s); // may have appeared empty
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28797#discussion_r2694290976