RFR: 8318986: Improve GenericWaitBarrier performance [v6]

Robbin Ehn rehn at openjdk.org
Tue Nov 21 06:37:16 UTC 2023


On Mon, 20 Nov 2023 21:57:27 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:

>> Aleksey Shipilev 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 13 additional commits since the last revision:
>> 
>>  - Drop the Linux check in preparation for integration
>>  - Merge branch 'master' into JDK-8318986-generic-wait-barrier
>>  - Merge branch 'master' into JDK-8318986-generic-wait-barrier
>>  - Rework paddings
>>  - Encode barrier tag into state, resolving another race condition
>>  - Simple review feedback fixes: tracking wakeup numbers, reflowing some methods
>>  - Merge branch 'master' into JDK-8318986-generic-wait-barrier
>>  - Touchups
>>  - More comments work
>>  - Tight up the comments
>>  - ... and 3 more: https://git.openjdk.org/jdk/compare/73f4ff78...191c0dbb
>
> src/hotspot/share/utilities/waitBarrier_generic.cpp line 191:
> 
>> 189:       break;
>> 190:     }
>> 191:     sp.wait();
> 
> Do we really need this SpinYield wait() here? I would expect failing that CAS is rare and a retry should work.

I don't think it is hurting, and some platform do not have a CAS, so Atomic::cmpxchg may be a load-reserve conditional store (risc-v). Which have the possibility of all failed with the cmpxchg.

These are the default, so we do spin 4096 times before we yield. (then yields 64 times before it sleeps)

  static const uint default_spin_limit = 4096;
  static const uint default_yield_limit = 64;
  static const uint default_sleep_ns = 1000;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16404#discussion_r1400085009


More information about the hotspot-dev mailing list