JDK-8293416 : ZGC: Set mark bit with unconditional atomic ops
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 20
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2022-09-06
  • Updated: 2022-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
**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.

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

Assigned to wangrui.

Thanks,
Leslie ZHai
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/10182 Date: 2022-09-06 10:48:19 +0000
06-09-2022