RFR: 8318986: Improve GenericWaitBarrier performance [v3]

Aleksey Shipilev shade at openjdk.org
Tue Nov 7 11:55:55 UTC 2023


On Tue, 7 Nov 2023 09:18:21 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> I thinking adding the barrier tag into the _state(64), so it's a 32-bit tag, and as now sign bit for armed/disarmed plus the 31-bit counter.
>
> Aw. Yes, there is a race condition here. It is plausible that waiter here can be stuck at previous barrier tag. I thought waiting for all threads to leave the cell on `arm()` saves us here, but it does not, because we might not know at `arm()` that we have a waiter waiting to enter.
> 
> Initially I thought to include `barrier_tag` into `_state`, so we can check for it before entering in this code, but somehow convinced myself it was not required. This counter-example directly shows that we want to encode `barrier_tag` into `_state` as well. Let me do that.

I pushed the new revision that incorporates review feedback and encodes `barrier_tag` into `_state`. It passes light testing. I am scheduling more thorough testing runs today. Feel free to take a look meanwhile!

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

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


More information about the hotspot-dev mailing list