RFR: 8343340: Swapping checking do not work for MetricsMemoryTester failcount [v2]

SendaoYan syan at openjdk.org
Mon Oct 20 02:12:17 UTC 2025


> Hi all,
> 
> The sub-test failcount in jdk/internal/platform/docker/TestDockerMemoryMetrics.java requires swap memory enable on the test host. But the swap memory check introduced by JDK-8264524 do not work correctly, because it's missing jvm option '-XX:+AlwaysPreTouch', shows as below. This PR add jvm option '-XX:+AlwaysPreTouch' to make the swap memory check work correctly, and use jtreg.SkippedException instead of print waring when this test can not execute.
> 
> Change has been verified locally on linux-x64. Test fix only, no risk.
> 
> 
>> free -h
> total used free shared buff/cache available
> Mem: 751Gi 513Gi 229Gi 5.0Mi 8.4Gi 234Gi
> Swap: 0B 0B 0B
> 
> 
> Without jvm option -XX:+AlwaysPreTouch, the 'java -Xms128m -Xmx128m -version' can start successfully:
> 
>> docker run --rm --memory=128m jdk-internal:test-jdk-internal-platform-docker-TestDockerMemoryMetrics-metrics-memory /jdk/bin/java -Xms128m -Xmx128m -version
> openjdk version "26" 2026-03-17
> OpenJDK Runtime Environment HJDK-0 (build 26+-42b2999c)
> OpenJDK 64-Bit Server VM HJDK-0 (build 26+-42b2999c, mixed mode, sharing)
> 
> 
> With jvm option -XX:+AlwaysPreTouch, the 'java -XX:+AlwaysPreTouch -Xms128m -Xmx128m -version' can not start and killed by docker(return code is 137):
> 
>> docker run --rm --memory=128m jdk-internal:test-jdk-internal-platform-docker-TestDockerMemoryMetrics-metrics-memory /jdk/bin/java -XX:+AlwaysPreTouch -Xms128m -Xmx128m -version ; echo $?
> 137

SendaoYan has updated the pull request incrementally with one additional commit since the last revision:

  Update the comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27823/files
  - new: https://git.openjdk.org/jdk/pull/27823/files/8d6a2b17..20ed6df6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27823&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27823&range=00-01

  Stats: 5 lines in 1 file changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/27823.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27823/head:pull/27823

PR: https://git.openjdk.org/jdk/pull/27823


More information about the serviceability-dev mailing list