Integrated: 8334147: Shenandoah: Avoid taking lock for disabled free set logging

Xiaolong Peng xpeng at openjdk.org
Fri Jun 28 06:22:25 UTC 2024


On Wed, 26 Jun 2024 21:57:54 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.

This pull request has now been integrated.

Changeset: c47a0e00
Author:    Xiaolong Peng <xpeng at openjdk.org>
Committer: Y. Srinivas Ramakrishna <ysr at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/c47a0e005e54551e42ee1ae33d7169417a5f86d4
Stats:     33 lines in 4 files changed: 14 ins; 9 del; 10 mod

8334147: Shenandoah: Avoid taking lock for disabled free set logging

Reviewed-by: shade, ysr

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

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


More information about the hotspot-gc-dev mailing list