RFR: 8360046: Scalability issue when submitting virtual threads with almost empty tasks [v5]
Doug Lea
dl at openjdk.org
Mon Sep 15 12:29:22 UTC 2025
On Thu, 14 Aug 2025 11:27:10 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Avoid underutilization on resize
>
> src/java.base/share/classes/java/util/concurrent/Exchanger.java line 380:
>
>> 378: (!ForkJoinWorkerThread.hasKnownQueuedWork()))) {
>> 379: for (int j = SPINS; p.match == null && j > 0; --j)
>> 380: Thread.onSpinWait();
>
> It might not be worth it, but I wonder if something like this would make a positive impact:
>
> Suggestion:
>
> if (!(tryCancel = (deadline != 0L &&
> (ns = deadline - System.nanoTime()) <= 0L) ||
> Thread.currentThread().isInterrupted()))
> && ncpu > 1 &&
> (i != 0 || /* check for busy VTs */ (!ForkJoinWorkerThread.hasKnownQueuedWork()))) {
> for (int j = SPINS; p.match == null && j > 0; --j)
> Thread.onSpinWait();
(No longer applicable -- moved to different PR)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2348828552
More information about the core-libs-dev
mailing list