From 97afbd9603ba8ec1956c4cedf542667d33988661 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johan=20Sj=C3=B6len?= <jsjolen@openjdk.org>
Date: Mon, 5 Aug 2024 14:49:38 +0000
Subject: [PATCH] 8336410: runtime/NMT/TotalMallocMmapDiffTest.java Total
 malloc diff is incorrect. Expected malloc diff range

Reviewed-by: gziemski, stuefe
---
 .../jtreg/runtime/NMT/TotalMallocMmapDiffTest.java       | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/hotspot/jtreg/runtime/NMT/TotalMallocMmapDiffTest.java b/test/hotspot/jtreg/runtime/NMT/TotalMallocMmapDiffTest.java
index 3ba94c6a31a..cd89bded578 100644
--- a/test/hotspot/jtreg/runtime/NMT/TotalMallocMmapDiffTest.java
+++ b/test/hotspot/jtreg/runtime/NMT/TotalMallocMmapDiffTest.java
@@ -32,7 +32,7 @@
  *          java.management
  * @build jdk.test.whitebox.WhiteBox
  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary -Xms32m -Xmx32m TotalMallocMmapDiffTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:TieredStopAtLevel=1 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary -Xms32m -Xmx32m TotalMallocMmapDiffTest
  *
  */
 
@@ -43,9 +43,10 @@ import jdk.test.whitebox.WhiteBox;
 public class TotalMallocMmapDiffTest {
     private static final WhiteBox wb = WhiteBox.getWhiteBox();
     private static final long ALLOCATE_SIZE = 250 * 1024 * 1024; // 250MB
-    private static final double FUDGE_FACTOR = 0.2;
-    private static final double UPPER_BOUND = ALLOCATE_SIZE * (1 + FUDGE_FACTOR);
-    private static final double LOWER_BOUND = ALLOCATE_SIZE * (1 - FUDGE_FACTOR);
+    private static final double FUDGE_FACTOR_UPPER = 0.3;
+    private static final double FUDGE_FACTOR_LOWER = 0.2;
+    private static final double UPPER_BOUND = ALLOCATE_SIZE * (1 + FUDGE_FACTOR_UPPER);
+    private static final double LOWER_BOUND = ALLOCATE_SIZE * (1 - FUDGE_FACTOR_LOWER);
 
     public static void main(String[] args) throws Exception {