On Tue, 15 Aug 2023 14:19:29 GMT, Viktor Klang <d...@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 45 additional commits 
>> since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - Update @since tags
>>  - resync
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - ExecutorService tests
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - Rework versioning
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - Merge branch 'openjdk:master' into JDK-8288899
>>  - ... and 35 more: https://git.openjdk.org/jdk/compare/3258dc09...585769c9
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 442:
> 
>> 440:      * queues are at odd indices. Worker phase ids masked with SMASK
>> 441:      * match their index. Shared (submission) queues are at even
>> 442:      * indices. Grouping them together in this way simplifies and
> 
> @DougLea Interesting—so by having the worker queues at odd indices increases 
> the likelihood of the then adjacent submission queues already having been 
> prefetched?

More-or-less. At top-level, both kinds of queues should be sampled with approx 
the same probability, which is simpler if they are all in the same array. But 
we also need to identify what kind they are without looking at them, leading to 
odd/even scheme. One disadvantage is that there are usually many fewer 
submission queues, so there can be a lot of wasted probes (null slots). But 
still cheaper than alternatives because of cache locality etc.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14301#discussion_r1295702036

Reply via email to