RFR: 8334147: Shenandoah: Avoid taking lock for free set logging [v3]

Xiaolong Peng xpeng at openjdk.org
Thu Jun 27 02:14:41 UTC 2024


> 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:

  Missed one log

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19915/files
  - new: https://git.openjdk.org/jdk/pull/19915/files/a8c07f96..d794e364

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19915&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19915&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/19915.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19915/head:pull/19915

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


More information about the hotspot-gc-dev mailing list