RFR: 8334513: New test gc/TestAlwaysPreTouchBehavior.java is failing on MacOS aarch64

Thomas Stuefe stuefe at openjdk.org
Thu May 22 13:42:52 UTC 2025


On Thu, 22 May 2025 08:08:29 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> I exhumed this old issue that fell through the cracks.
>> 
>> The test wants to make sure AlwaysPreTouch works by pretouching the java heap and comparing RSS with heap size. 
>> 
>> This technique is shaky: if the host machine experiences memory pressure, part of the pretouched memory will be swapped out before we measure RSS.
>> 
>> There is no way to make this bulletproof; still, this test is too useful to abandon it. Therefore I modified this test to make false positives (hopefully) very unlikely. See comment in test for details.
>> 
>> See old PR: https://github.com/openjdk/jdk/pull/19803
>
> src/hotspot/os/bsd/os_bsd.cpp line 147:
> 
>> 145: // Available here means free. Note that this number is of no much use. As an estimate
>> 146: // for future memory pressure it is far too conservative, since MacOS will use a lot
>> 147: // of unused memory for caches, and return it willingly in case of needs.
> 
> So we use only free_count but this is a bad estimate because it misses a number of categories.
> There is a bit of discussion here
> https://github.com/giampaolo/psutil/issues/1277
> and at least  'Pages inactive' (vmstat.inactive_count  (Recently used, not currently needed)) should be added here .
> Maybe also the speculative pages.
> What do you think ?
> Would be a separate JBS issue / PR I guess ?

Definitely worth exploring. Feel free to open a JBS issue and/or to fix it :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25384#discussion_r2102596192


More information about the hotspot-dev mailing list