On Wed, 29 May 2024 14:19:52 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

>> Doug Lea has updated the pull request with a new target base due to a merge 
>> or a rebase. The incremental webrev excludes the unrelated changes brought 
>> in by the merge/rebase. The pull request contains 41 additional commits 
>> since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into JDK-8322732
>>  - Add test for utilization with interdependent tasks
>>  - Un-misplace onSpinWait call
>>  - Adjust control flow
>>  - Reduce memory stalls
>>  - Merge branch 'openjdk:master' into JDK-8322732
>>  - More performance tradoffs
>>  - Address review comments
>>  - Merge branch 'openjdk:master' into JDK-8322732
>>  - Repack some fields; adjust control flow
>>  - ... and 31 more: https://git.openjdk.org/jdk/compare/2d88272f...cf5fe55c
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2094:
> 
>> 2092:                         if (((p = w.phase) & IDLE) != 0)
>> 2093:                             p = awaitWork(w, delay); // block, drop, 
>> or exit
>> 2094:                     }
> 
> I'm presuming the code below would be equivalent but avoid calculating the 
> delay unless w.phase is IDLE?
> 
> Suggestion:
> 
>                     if ((p & IDLE) != 0 && ((p = w.phase) & IDLE) != 0) {
>                         long delay = (((qc & RC_MASK) > 0L) ? 0L :
>                                       (w.source != INVALID_ID) ? keepAlive :
>                                       TIMEOUT_SLOP); // minimal delay if 
> cascade
>                         p = awaitWork(w, delay); // block, drop, or exit
>                     }

Seems slightly better not to recheck until call, since previous loop would 
usually have caught this if there was actually any work.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1619034460

Reply via email to