RFR: 8262188: Add test to verify trace page sizes logging on Linux

Thomas Stuefe stuefe at openjdk.java.net
Wed Feb 24 12:39:39 UTC 2021


On Wed, 24 Feb 2021 12:29:02 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> test/hotspot/jtreg/runtime/os/TestTracePageSizes.java line 168:
>> 
>>> 166: 
>>> 167:         // The test needs to be run with page size logging printed to ps-$pid.log.
>>> 168:         Scanner fileScanner = new Scanner(new File("./ps-" + ProcessHandle.current().pid() + ".log"));
>> 
>> So we scan the log file while it is being written by ourselves? This seems slightly unsafe. Are we sure it has been completely flushed at this point? I'm mainly concerned about things like running this test in a current dir on NFS or somesuch.
>> 
>> An alternative would be to let the testee write the log file and print out a copy of /proc/self/smaps to stdout, then to scan and compare in a separate process. 
>> 
>> But if you think this is safe enough, I'm fine with this too.
>
> Not really while it is being written, since all the output from `-Xlog:pagesize` happens before the java test is executed and from what I can tell the log-file should be properly flushed.
> 
> As you say doing the scan and compare in a separate process afterwards would make any concurrent modification issue and flush issue go away. But it would also slightly complicate the test and make it depend on the test library. For debugging it is very nice to be able to run the test standalone and that is a bit harder when depending on the test lib.
> 
> Until proven unsafe I would prefer to leave it as is.

I'd say so too. If that pattern works, I may use it in other places too.

>> test/hotspot/jtreg/runtime/os/TestTracePageSizes.java line 81:
>> 
>>> 79:  * @run main/othervm -XX:+AlwaysPreTouch -Xlog:pagesize:ps-%p.log -XX:+UseSerialGC -XX:+UseLargePages TestTracePageSizes
>>> 80:  * @run main/othervm -XX:+AlwaysPreTouch -Xlog:pagesize:ps-%p.log -XX:+UseSerialGC -XX:+UseTransparentHugePages TestTracePageSizes
>>> 81: */
>> 
>> I see you don't explicitly test UseSHM. Because the number of tests would be too large?
>
> I don't explicitly test HugeTLBFS either, but yes that is what's being tested when just setting `+UseLargePages` =) Would you prefer if I had one `@run` for `-XX:+UseHugeTLBFS` and one for `-XX:+UseSHM`.

I think this is fine for now; hopefully we'll get rid of UseSHM.

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

PR: https://git.openjdk.java.net/jdk/pull/2696


More information about the hotspot-runtime-dev mailing list