RFR: 8341554: Shenandoah: Missing heap lock when updating usage for soft ref policy

Y. Srinivas Ramakrishna ysr at openjdk.org
Fri Oct 4 20:43:36 UTC 2024


On Fri, 4 Oct 2024 19:18:42 GMT, William Kemper <wkemper at openjdk.org> wrote:

> A recent change to avoid checking the log level under the lock inadvertently removed the lock from an operation that needs it.

Good catch by @kdnilsen !

Sorry for missing this in the previous review at https://github.com/openjdk/jdk/pull/19915 for @pengxiaolong.

src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 186:

> 184:         ShenandoahHeapLocker locker(heap->lock());
> 185:         heap->update_capacity_and_used_at_gc();
> 186:       }

If free set logging is enabled this does a lock/unlock for logging and then another lock/unlock for updating capacity.

But I guess it's unavoidable, and it likely won't be the case that we have free set logging enabled in performance critical production situations, so not worth wasting too much sleep over.

Reviewed!

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

Marked as reviewed by ysr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21362#pullrequestreview-2349091755
PR Review Comment: https://git.openjdk.org/jdk/pull/21362#discussion_r1788281685


More information about the hotspot-gc-dev mailing list