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

Kim Barrett kbarrett at openjdk.org
Tue Sep 6 17:30:48 UTC 2022


On Tue, 6 Sep 2022 11:01:08 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 refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   8293416: ZGC: Set mark bit with unconditional atomic ops

The Atomic changes being proposed here are a subset of
https://bugs.openjdk.org/browse/JDK-8293117 Add atomic bitset functions
which is in-progress.

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

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


More information about the hotspot-dev mailing list