RFR: 8330849: Add test to verify memory usage with recursive locking [v2]
Leonid Mesnik
lmesnik at openjdk.org
Mon Apr 22 21:31:30 UTC 2024
On Mon, 22 Apr 2024 20:05:42 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> Before recursive support has been added to lightweight locking, using recursive locking patterns would inflate lightweight locks to full monitors. In some scenarios (when churning lots of recursively locked objects), this could lead to excessive native memory usage. I'd like to add a test that verifies that this does not happen.
>>
>> I verified that the new test fails reliably with an earlier commit that did not have LW recursive locking, yet, and passes with latest LW recursive locking.
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>
> Make test less restrictive
There are few more small comments. Sorry that I missed them first time.
test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java line 35:
> 33: * @summary Tests that recursive locking doesn't cause excessive native memory usage
> 34: * @library /test/lib
> 35: * @run main TestRecursiveMonitorChurn
Better to use
@run driver TestRecursiveMonitorChurn
for tests which fork VM.
test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java line 39:
> 37: public class TestRecursiveMonitorChurn {
> 38: static class Monitor {
> 39: volatile int i, j;
Not sure if volatile makes sense here. But it is better to make i, j public static so the compiler can't optimize them.
(The even better would be to print them in main()).
test/hotspot/jtreg/runtime/locking/TestRecursiveMonitorChurn.java line 88:
> 86: throw new RuntimeException("Allocated too many monitors");
> 87: }
> 88: foundLine = true;
Small nit.
There is should be only one line like ' Object Monitors (reserved=20800624, committed=20800624)'
Some might just return true here? So no foundLine is needed.
-------------
Changes requested by lmesnik (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18899#pullrequestreview-2015825668
PR Review Comment: https://git.openjdk.org/jdk/pull/18899#discussion_r1575372136
PR Review Comment: https://git.openjdk.org/jdk/pull/18899#discussion_r1575373642
PR Review Comment: https://git.openjdk.org/jdk/pull/18899#discussion_r1575377678
More information about the hotspot-runtime-dev
mailing list