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
* @requires vm.gc.Z & os.family == "linux"
* @requires !vm.opt.final.UseLargePages
* @requires !vm.opt.final.UseTransparentHugePages
* @summary Test ZGC with -XX:AllocateHeapAt
* @library /test/lib
* @run main/othervm gc.z.TestAllocateHeapAt . true
* @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 jtreg.SkippedException;
public class TestAllocateHeapAt {
public static void main(String[] args) throws Exception {
@ -42,6 +46,13 @@ public class TestAllocateHeapAt {
final String heapBackingFile = "Heap Backing 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(
"-XX:+UseZGC",
"-Xlog:gc*",

View File

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

View File

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

View File

@ -28,12 +28,14 @@
* @library /test/lib
* @requires vm.flagless
* @requires os.family == "linux"
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run driver TestHugePageDetection
*/
import java.util.*;
import jdk.test.lib.os.linux.HugePageConfiguration;
import jdk.test.lib.process.OutputAnalyzer;
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, "UseCompressedOops");
vmOptFinalFlag(map, "UseLargePages");
vmOptFinalFlag(map, "UseTransparentHugePages");
vmOptFinalFlag(map, "UseVectorizedMismatchIntrinsic");
}

View File

@ -22,6 +22,8 @@
* questions.
*/
package jdk.test.lib.os.linux;
import jdk.test.lib.process.OutputAnalyzer;
import java.io.*;
@ -33,7 +35,7 @@ import java.util.regex.Pattern;
// - a) the Operating System (the truth)
// - 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.
class HugePageConfiguration {
public class HugePageConfiguration {
public static class ExplicitHugePageConfig implements Comparable<ExplicitHugePageConfig> {
public long pageSize = -1;
@ -63,11 +65,11 @@ class HugePageConfiguration {
Set<ExplicitHugePageConfig> _explicitHugePageConfigurations;
long _explicitDefaultHugePageSize = -1;
enum THPMode {always, never, madvise}
public enum THPMode {always, never, madvise}
THPMode _thpMode;
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;
public Set<ExplicitHugePageConfig> getExplicitHugePageConfigurations() {
@ -133,6 +135,15 @@ class HugePageConfiguration {
'}';
}
@Override
public int hashCode() {
return Objects.hash(_explicitDefaultHugePageSize,
_thpPageSize,
_explicitHugePageConfigurations,
_thpMode,
_shmemThpMode);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;