8340422: ZGC: TestAllocateHeapAt.java should not run with transparent hugepages

Reviewed-by: stefank, jsikstro
This commit is contained in:
Axel Boldt-Christmas 2024-11-21 09:54:25 +00:00
parent 5ccd5106e0
commit f2b10c6c22
6 changed files with 33 additions and 3 deletions

View File

@ -27,13 +27,17 @@ package gc.z;
* @test TestAllocateHeapAt * @test TestAllocateHeapAt
* @requires vm.gc.Z & os.family == "linux" * @requires vm.gc.Z & os.family == "linux"
* @requires !vm.opt.final.UseLargePages * @requires !vm.opt.final.UseLargePages
* @requires !vm.opt.final.UseTransparentHugePages
* @summary Test ZGC with -XX:AllocateHeapAt * @summary Test ZGC with -XX:AllocateHeapAt
* @library /test/lib * @library /test/lib
* @run main/othervm gc.z.TestAllocateHeapAt . true * @run main/othervm gc.z.TestAllocateHeapAt . true
* @run main/othervm gc.z.TestAllocateHeapAt non-existing-directory false * @run main/othervm gc.z.TestAllocateHeapAt non-existing-directory false
*/ */
import jdk.test.lib.os.linux.HugePageConfiguration;
import jdk.test.lib.os.linux.HugePageConfiguration.ShmemTHPMode;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
public class TestAllocateHeapAt { public class TestAllocateHeapAt {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
@ -42,6 +46,13 @@ public class TestAllocateHeapAt {
final String heapBackingFile = "Heap Backing File: " + directory; final String heapBackingFile = "Heap Backing File: " + directory;
final String failedToCreateFile = "Failed to create file " + directory; final String failedToCreateFile = "Failed to create file " + directory;
final HugePageConfiguration hugePageConfiguration = HugePageConfiguration.readFromOS();
final ShmemTHPMode mode = hugePageConfiguration.getShmemThpMode();
if (mode != ShmemTHPMode.never && mode != ShmemTHPMode.advise) {
throw new SkippedException("The UseTransparentHugePages option may not be respected with Shmem THP Mode: " + mode.name());
}
ProcessTools.executeTestJava( ProcessTools.executeTestJava(
"-XX:+UseZGC", "-XX:+UseZGC",
"-Xlog:gc*", "-Xlog:gc*",

View File

@ -45,10 +45,13 @@
* @requires os.family == "linux" * @requires os.family == "linux"
* @requires vm.debug * @requires vm.debug
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
* @library /test/lib
* @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.misc
* java.management * java.management
* @run main/manual THPsInThreadStackPreventionTest PATCH-DISABLED * @run main/manual THPsInThreadStackPreventionTest PATCH-DISABLED
*/ */
import jdk.test.lib.os.linux.HugePageConfiguration;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException; import jtreg.SkippedException;

View File

@ -47,11 +47,13 @@
* @summary Test JVM large page setup (+THP) * @summary Test JVM large page setup (+THP)
* @library /test/lib * @library /test/lib
* @requires os.family == "linux" * @requires os.family == "linux"
* @library /test/lib
* @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.misc
* java.management * java.management
* @run driver TestHugePageDecisionsAtVMStartup -XX:+UseTransparentHugePages * @run driver TestHugePageDecisionsAtVMStartup -XX:+UseTransparentHugePages
*/ */
import jdk.test.lib.os.linux.HugePageConfiguration;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -28,12 +28,14 @@
* @library /test/lib * @library /test/lib
* @requires vm.flagless * @requires vm.flagless
* @requires os.family == "linux" * @requires os.family == "linux"
* @library /test/lib
* @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.misc
* java.management * java.management
* @run driver TestHugePageDetection * @run driver TestHugePageDetection
*/ */
import java.util.*; import java.util.*;
import jdk.test.lib.os.linux.HugePageConfiguration;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;

View File

@ -378,6 +378,7 @@ public class VMProps implements Callable<Map<String, String>> {
vmOptFinalFlag(map, "UnlockExperimentalVMOptions"); vmOptFinalFlag(map, "UnlockExperimentalVMOptions");
vmOptFinalFlag(map, "UseCompressedOops"); vmOptFinalFlag(map, "UseCompressedOops");
vmOptFinalFlag(map, "UseLargePages"); vmOptFinalFlag(map, "UseLargePages");
vmOptFinalFlag(map, "UseTransparentHugePages");
vmOptFinalFlag(map, "UseVectorizedMismatchIntrinsic"); vmOptFinalFlag(map, "UseVectorizedMismatchIntrinsic");
} }

View File

@ -22,6 +22,8 @@
* questions. * questions.
*/ */
package jdk.test.lib.os.linux;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import java.io.*; import java.io.*;
@ -33,7 +35,7 @@ import java.util.regex.Pattern;
// - a) the Operating System (the truth) // - a) the Operating System (the truth)
// - b) the JVM log (-Xlog:pagesize) // - b) the JVM log (-Xlog:pagesize)
// This is used e.g. in TestHugePageDetection to determine if the JVM detects the correct settings from the OS. // This is used e.g. in TestHugePageDetection to determine if the JVM detects the correct settings from the OS.
class HugePageConfiguration { public class HugePageConfiguration {
public static class ExplicitHugePageConfig implements Comparable<ExplicitHugePageConfig> { public static class ExplicitHugePageConfig implements Comparable<ExplicitHugePageConfig> {
public long pageSize = -1; public long pageSize = -1;
@ -63,11 +65,11 @@ class HugePageConfiguration {
Set<ExplicitHugePageConfig> _explicitHugePageConfigurations; Set<ExplicitHugePageConfig> _explicitHugePageConfigurations;
long _explicitDefaultHugePageSize = -1; long _explicitDefaultHugePageSize = -1;
enum THPMode {always, never, madvise} public enum THPMode {always, never, madvise}
THPMode _thpMode; THPMode _thpMode;
long _thpPageSize; long _thpPageSize;
enum ShmemTHPMode {always, within_size, advise, never, deny, force, unknown} public enum ShmemTHPMode {always, within_size, advise, never, deny, force, unknown}
ShmemTHPMode _shmemThpMode; ShmemTHPMode _shmemThpMode;
public Set<ExplicitHugePageConfig> getExplicitHugePageConfigurations() { public Set<ExplicitHugePageConfig> getExplicitHugePageConfigurations() {
@ -133,6 +135,15 @@ class HugePageConfiguration {
'}'; '}';
} }
@Override
public int hashCode() {
return Objects.hash(_explicitDefaultHugePageSize,
_thpPageSize,
_explicitHugePageConfigurations,
_thpMode,
_shmemThpMode);
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;