RFR: 8334147: Shenandoah: Avoid taking lock for free set logging [v6]
Xiaolong Peng
xpeng at openjdk.org
Thu Jun 27 07:43:10 UTC 2024
On Thu, 27 Jun 2024 07:37:36 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:
>> Hi all,
>> This pull request propose a fix for the issue https://bugs.openjdk.org/browse/JDK-8334147
>>
>>> There are multiple places in Shenandoah where we take heap lock for potential free set diagnostics. There is no point in taking that lock if we do not report anything. We should at very least take the lock only when logging is actually needed.
>>
>> Basically it adds a public method ```ShenandoahFreeSet::log_status_with_heap_lock``` which acquire lock when there is need to print logs, also make the ```log_status``` private since not expect it to be called out of ShenandoahFreeSet class.
>>
>> <s>The change for ShenandoahFreeSet::rebuild is probably debatable, ShenandoahFreeSet::log_status will acquire lock again after ShenandoahFreeSet::rebuild is executed, hence the metrics/information in log may not be always consistent, but it might be fine. </s>
>>
>> Additional test:
>> - [x] `make test TEST=hotspot_gc_shenandoah`
>>
>> Test summary
>> ==============================
>> TEST TOTAL PASS FAIL ERROR
>> jtreg:test/hotspot/jtreg:hotspot_gc_shenandoah 259 259 0 0
>> ==============================
>> TEST SUCCESS
>>
>>
>> Best,
>> Xiaolong.
>
> Xiaolong Peng has updated the pull request incrementally with one additional commit since the last revision:
>
> Make log_status_with_heap_locked public
There is one test failure which I can't really understand how it is possible, but making log_status_with_heap_locked public instead private seems working, making it even weirder.
compiler.interpreter.Test6833129.java on linux-x86
Error: [0.582s][error][gc,verify] Object 0xa6d80010 has a null klass
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xf452b5c7, pid=12043, tid=12066
#
# JRE version: OpenJDK Runtime Environment (24.0) (fastdebug build 24-internal-pengxiaolong-8ea36214a538412f1a304ce0968c74ac120a5b45)
# Java VM: OpenJDK Server VM (fastdebug 24-internal-pengxiaolong-8ea36214a538412f1a304ce0968c74ac120a5b45, mixed mode, sharing, tiered, g1 gc, linux-x86)
# Problematic frame:
# V [libjvm.so+0x52b5c7] oopDesc::size_given_klass(Klass*)+0x17
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19915#issuecomment-2194010253
More information about the hotspot-gc-dev
mailing list