Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
21
-
b10
-
riscv
-
linux
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8311753 | 17.0.9 | Fei Yang | P4 | Resolved | Fixed | b01 |
Description
This PR will optimize some function in class atomic. We will not need FULL_MEM_BARRIER anymore when order is memory_order_relaxed. This is the first version and maybe we can improve this part with different memory order in the further, just like JDK-8274615 and JDK-8261649.
The following call stack uses memory_order_relaxed:
```
#0 Atomic::PlatformAdd<8ul>::add_and_fetch<unsigned long, unsigned long> (this=0x40038851d0, dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:40
#1 0x0000004001d200a2 in Atomic::AddImpl<unsigned long, unsigned long, void>::add_and_fetch (dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/share/runtime/atomic.hpp:681
#2 0x0000004001d1ff9a in Atomic::add<unsigned long, unsigned long> (dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/share/runtime/atomic.hpp:662
#3 0x0000004001d1f55c in MemoryCounter::allocate (this=0x40035b0820 <MallocMemorySummary::_snapshot+576>, sz=96) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:63
#4 0x0000004002613608 in MallocMemory::record_malloc (this=0x40035b0820 <MallocMemorySummary::_snapshot+576>, sz=96) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:113
#5 0x0000004002613676 in MallocMemorySummary::record_malloc (size=96, flag=MEMFLAGS::mtInternal) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:244
```
By the way, this PR will also polish inline assembly code of PlatformCmpxchg.
The following call stack uses memory_order_relaxed:
```
#0 Atomic::PlatformAdd<8ul>::add_and_fetch<unsigned long, unsigned long> (this=0x40038851d0, dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/os_cpu/linux_riscv/atomic_linux_riscv.hpp:40
#1 0x0000004001d200a2 in Atomic::AddImpl<unsigned long, unsigned long, void>::add_and_fetch (dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/share/runtime/atomic.hpp:681
#2 0x0000004001d1ff9a in Atomic::add<unsigned long, unsigned long> (dest=0x40035b0820 <MallocMemorySummary::_snapshot+576>, add_value=1, order=memory_order_relaxed)
at /home/dingli/jdk/src/hotspot/share/runtime/atomic.hpp:662
#3 0x0000004001d1f55c in MemoryCounter::allocate (this=0x40035b0820 <MallocMemorySummary::_snapshot+576>, sz=96) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:63
#4 0x0000004002613608 in MallocMemory::record_malloc (this=0x40035b0820 <MallocMemorySummary::_snapshot+576>, sz=96) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:113
#5 0x0000004002613676 in MallocMemorySummary::record_malloc (size=96, flag=MEMFLAGS::mtInternal) at /home/dingli/jdk/src/hotspot/share/services/mallocTracker.hpp:244
```
By the way, this PR will also polish inline assembly code of PlatformCmpxchg.
Attachments
Issue Links
- backported by
-
JDK-8311753 RISC-V: Optimize class atomic when order is memory_order_relaxed
- Resolved
- links to
-
Commit openjdk/jdk17u-dev/966fc82d
-
Commit openjdk/jdk/1fec6b59
-
Commit openjdk/riscv-port-jdk17u/bac6ef76
-
Review openjdk/jdk17u-dev/1427
-
Review openjdk/jdk/12434
-
Review openjdk/riscv-port-jdk17u/60
(2 links to)