RFR: 8318986: Improve GenericWaitBarrier performance [v6]

Robbin Ehn rehn at openjdk.org
Tue Nov 21 07:07:08 UTC 2023


On Tue, 21 Nov 2023 06:34:01 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> 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.
>
> If we fail we need to reload _state, when the other CPU just invalidated that cache-line.
> Then a spin-pause just before would actually be bad, but since it so rarely happens it doesn't matter.
> 
> But some platform do not have a CAS, so Atomic::cmpxchg may be a load-reserve store-conditional (risc-v). Which have the (at least theoretical) possibility of all failed with the cmpxchg.
> As LR/SC is a bit unpredictable, and there are a number of hw vendors, I think it's good to have this just in case.

https://lore.kernel.org/all/20230910082911.3378782-10-guoren@kernel.org/

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

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


More information about the hotspot-dev mailing list