RFR: 8315923: pretouch_memory by atomic-add-0 fragments huge pages unexpectedly [v21]

Thomas Stuefe stuefe at openjdk.org
Fri Jan 12 09:50:30 UTC 2024


On Fri, 12 Jan 2024 09:15:47 GMT, Liming Liu <duke at openjdk.org> wrote:

>> test/hotspot/jtreg/runtime/os/TestTransparentHugePageUsage.java line 46:
>> 
>>> 44: import java.util.regex.Matcher;
>>> 45: import java.util.regex.Pattern;
>>> 46: import jdk.test.lib.process.ProcessTools;
>> 
>> Please add a comment describing what the test does. E.g. "Tests checks that a pretouched java heap appears to use THPs by checking AnonHugePages in smaps". Feel free to find a better formulation.
>> 
>> Does the test fail without madvise, at least sporadically?
>> 
>> So I wonder whether it would be better to run with SerialGC, to limit the pretouching to one thread. That would increase the time window needed for pretouching and give us a higher chance to observe those small pages that appear before khugepaged gets around merging them into THPs.
>
> It almost certainly fails with 512MB huge pages and without madvise when vm_page_size is 64KB, but does not likely fail with 2MB huge pages. I would change the check of usage from 0 to 524288 (512MB in KB), and then it would fail with 2MB huge pages.

That is a good idea. We don't need perfection, just a test that has a reasonable chance of informing us when someone breaks your logic.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15781#discussion_r1450149130


More information about the hotspot-runtime-dev mailing list