RFR: 8293416: ZGC: Set mark bit with unconditional atomic ops [v3]

hev duke at openjdk.org
Thu Sep 8 08:24:53 UTC 2022


On Thu, 8 Sep 2022 08:15:28 GMT, hev <duke at openjdk.org> wrote:

>> **Summary**
>> Support to set ZGC mark bit with unconditional atomic ops.
>> 
>> **Motivation**
>> ZGC currently modify mark-bitmap by a conditional atomic operation (cmpxchg). This way is not optimal, which will retry the loop when cmpxchg fails.
>> 
>> **Description**
>> First, This patch-set add an new unconditional atomic operation: Atomic::fetch_and_or, which is implemented in different ways for different CPU architectures:
>> 
>> * Exclusive access: Non-nested loop
>> 
>> 
>> retry:
>>   ll old_val, addr
>>   or new_val, old_val, set_val
>>   sc new_val, addr
>>   beq retry
>> 
>> 
>> * Atomic access: One instruction
>> 
>> 
>> ldset old_val, set_val, addr
>> 
>> 
>> * Generic: Fallback to cmpxchg or use c++ __atomic_fetch_or
>> 
>> **Testing**
>> * jtreg tests
>> * benchmark tests
>
> hev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - ZGC: Set mark bit with unconditional atomic ops
>  - BitMap: Set bit with unconditional atomic ops
>  - Atomic: Add bitset functions

Hello,

I will rebase this patchset when JDK-8293117 (https://bugs.openjdk.org/browse/JDK-8293117)  is done. Atomic: Add bitset functions(https://github.com/openjdk/jdk/pull/10182/commits/dc15c68d1ff0e5c7445b333d45dc562881f5687e) contains a few architecture (not all) implementations, and only for test.

RFC,
Thanks~

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

PR: https://git.openjdk.org/jdk/pull/10182


More information about the hotspot-dev mailing list