RFR: 8343394: Make MemorySessionImpl.state a stable field [v3]

Quan Anh Mai qamai at openjdk.org
Thu Oct 31 18:17:34 UTC 2024


On Thu, 31 Oct 2024 17:03:31 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix benchmarks
>
> src/java.base/share/classes/jdk/internal/foreign/SharedSession.java line 90:
> 
>> 88:         }
>> 89: 
>> 90:         state = CLOSED;
> 
> I like it that we still only have one CAS here (as only one thread can set CLOSED_ACQUIRE_COUNT). So shared arena close doesn't need more work. You might want to check the MemorySessionClose bench, just in case.

This is the result, as expected an additional `store` is negligible compared to the hand shake below:

                                                                          Before            After
    Benchmark                                    (mode)  Mode  Cnt    Score    Error    Score    Error  Units
    MemorySessionClose.confined_close              NONE  avgt   30    0.035 ±  0.001    0.036 ±  0.001  us/op
    MemorySessionClose.confined_close            MEMORY  avgt   30    0.037 ±  0.002    0.036 ±  0.001  us/op
    MemorySessionClose.confined_close           THREADS  avgt   30    0.043 ±  0.003    0.040 ±  0.002  us/op
    MemorySessionClose.implicit_close              NONE  avgt   30    1.957 ±  2.298   12.308 ± 22.991  us/op
    MemorySessionClose.implicit_close            MEMORY  avgt   30   34.902 ± 58.169   13.014 ± 27.360  us/op
    MemorySessionClose.implicit_close           THREADS  avgt   30    5.858 ± 17.937    0.861 ±  0.358  us/op
    MemorySessionClose.implicit_close_systemgc     NONE  avgt   30   11.926 ±  0.215   11.594 ±  0.083  us/op
    MemorySessionClose.implicit_close_systemgc   MEMORY  avgt   30  781.714 ± 12.765  770.620 ± 10.499  us/op
    MemorySessionClose.implicit_close_systemgc  THREADS  avgt   30   12.005 ±  0.084   11.890 ±  0.058  us/op
    MemorySessionClose.shared_close                NONE  avgt   30   22.537 ±  0.161   22.729 ±  0.200  us/op
    MemorySessionClose.shared_close              MEMORY  avgt   30   22.795 ±  0.223   22.722 ±  0.246  us/op
    MemorySessionClose.shared_close             THREADS  avgt   30   26.702 ±  0.476   26.904 ±  0.539  us/op

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21810#discussion_r1824976177


More information about the core-libs-dev mailing list