Integrated: 8301852: RISC-V: Optimize class atomic when order is memory_order_relaxed

Dingli Zhang dzhang at openjdk.org
Mon Feb 13 02:05:36 UTC 2023


On Mon, 6 Feb 2023 12:19:18 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:

> 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](https://bugs.openjdk.org/browse/JDK-8274615) and [JDK-8261649](https://bugs.openjdk.org/browse/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.
> 
> ## Testing:
> 
> - all tier1-3 on unmatched board without new failures

This pull request has now been integrated.

Changeset: 1fec6b59
Author:    Dingli Zhang <dzhang at openjdk.org>
Committer: Fei Yang <fyang at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1fec6b5953b51dae4be640d6e4e4f79136b9348d
Stats:     36 lines in 1 file changed: 18 ins; 1 del; 17 mod

8301852: RISC-V: Optimize class atomic when order is memory_order_relaxed

Reviewed-by: fyang

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

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


More information about the hotspot-runtime-dev mailing list