On Thu, 14 Aug 2025 11:34:19 GMT, Viktor Klang <vkl...@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/ForkJoinPool.java line 1290:
> 
>> 1288:                     if (room == 0) {                        // resize
>> 1289:                         growArray(a, cap, s);
>> 1290:                         a = null;
> 
> Suggestion:
> 
>                         a = null;  // Indicate resize to trigger signalling

(No longer applies)

> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1299:
> 
>> 1297:                 if (pool != null &&
>> 1298:                     (a == null ||                // always signal on 
>> resize
>> 1299:                      U.getReferenceAcquire(a, slotOffset(m & (s - 1))) 
>> == null))
> 
> @DougLea Interesting. Is the reason that it is cheaper to check `a` for null 
> here that it elides a nullcheck in the getReferenceAcquire? (even if it adds 
> the cost of nulling out `a` after growArray())

(No longer applies)

> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2003:
> 
>> 2001:                                     continue rescan;
>> 2002:                                 if (b == (b = q.base) && a[bk] == 
>> null) {
>> 2003:                                     if (a[nk] == null && a[(b + 2) & 
>> m] == null) {
> 
> @DougLea Seems worth it to add a comment around why we're looking at b + 2 
> here.

sorta done (but with implicit ref to leading docs)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2348768921
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2348765617
PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2348767307

Reply via email to