author | sangheki |
Wed, 13 Nov 2019 10:51:41 -0800 | |
changeset 59062 | 6530de931b8e |
parent 59060 | fce1fa1bdc91 |
permissions | -rw-r--r-- |
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
1 |
/* |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
4 |
* |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
8 |
* |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
13 |
* accompanied this code). |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
14 |
* |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
18 |
* |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
21 |
* questions. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
22 |
*/ |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
23 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
24 |
package gc.g1; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
25 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
26 |
/** |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
27 |
* @test TestG1NUMATouchRegions |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
28 |
* @summary Ensure the bottom of the given heap regions are properly touched with requested NUMA id. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
29 |
* @key gc |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
30 |
* @requires vm.gc.G1 |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
31 |
* @requires os.family == "linux" |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
32 |
* @library /test/lib |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
33 |
* @modules java.base/jdk.internal.misc |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
34 |
* java.management |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
35 |
* @build sun.hotspot.WhiteBox |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
36 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
37 |
* @run main/othervm -XX:+UseG1GC -Xbootclasspath/a:. -XX:+UseNUMA -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.g1.TestG1NUMATouchRegions |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
38 |
*/ |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
39 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
40 |
import java.util.LinkedList; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
41 |
import jdk.test.lib.process.OutputAnalyzer; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
42 |
import jdk.test.lib.process.ProcessTools; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
43 |
import sun.hotspot.WhiteBox; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
44 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
45 |
public class TestG1NUMATouchRegions { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
46 |
enum NUMASupportStatus { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
47 |
NOT_CHECKED, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
48 |
SUPPORT, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
49 |
NOT_SUPPORT |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
50 |
}; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
51 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
52 |
static int G1HeapRegionSize1MB = 1; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
53 |
static int G1HeapRegionSize8MB = 8; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
54 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
55 |
static NUMASupportStatus status = NUMASupportStatus.NOT_CHECKED; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
56 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
57 |
public static void main(String[] args) throws Exception { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
58 |
// 1. Page size < G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
59 |
// Test default page with 1MB heap region size |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
60 |
testMemoryTouch("-XX:-UseLargePages", G1HeapRegionSize1MB); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
61 |
// 2. Page size > G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
62 |
// Test large page with 1MB heap region size. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
63 |
testMemoryTouch("-XX:+UseLargePages", G1HeapRegionSize1MB); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
64 |
// 3. Page size < G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
65 |
// Test large page with 8MB heap region size. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
66 |
testMemoryTouch("-XX:+UseLargePages", G1HeapRegionSize8MB); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
67 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
68 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
69 |
// On Linux, always UseNUMA is enabled if there is multiple active numa nodes. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
70 |
static NUMASupportStatus checkNUMAIsEnabled(OutputAnalyzer output) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
71 |
boolean supportNUMA = Boolean.parseBoolean(output.firstMatch("\\bUseNUMA\\b.*?=.*?([a-z]+)", 1)); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
72 |
System.out.println("supportNUMA=" + supportNUMA); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
73 |
return supportNUMA ? NUMASupportStatus.SUPPORT : NUMASupportStatus.NOT_SUPPORT; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
74 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
75 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
76 |
static long parseSizeString(String size) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
77 |
long multiplier = 1; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
78 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
79 |
if (size.endsWith("B")) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
80 |
multiplier = 1; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
81 |
} else if (size.endsWith("K")) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
82 |
multiplier = 1024; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
83 |
} else if (size.endsWith("M")) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
84 |
multiplier = 1024 * 1024; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
85 |
} else if (size.endsWith("G")) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
86 |
multiplier = 1024 * 1024 * 1024; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
87 |
} else { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
88 |
throw new IllegalArgumentException("Expected memory string '" + size + "'to end with either of: B, K, M, G"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
89 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
90 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
91 |
long longSize = Long.parseUnsignedLong(size.substring(0, size.length() - 1)); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
92 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
93 |
return longSize * multiplier; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
94 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
95 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
96 |
static long heapPageSize(OutputAnalyzer output) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
97 |
String HeapPageSizePattern = "Heap: .*page_size=([^ ]+)"; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
98 |
String str = output.firstMatch(HeapPageSizePattern, 1); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
99 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
100 |
if (str == null) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
101 |
output.reportDiagnosticSummary(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
102 |
throw new RuntimeException("Match from '" + HeapPageSizePattern + "' got 'null'"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
103 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
104 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
105 |
return parseSizeString(str); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
106 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
107 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
108 |
// 1. -UseLargePages: default page, page size < G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
109 |
// +UseLargePages: large page size <= G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
110 |
// |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
111 |
// Each 'int' represents a numa id of single HeapRegion (bottom page). |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
112 |
// e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
113 |
// Check the first set(2 regions) |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
114 |
// 0| ...omitted..| 0 |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
115 |
// 1| ...omitted..| 1 |
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
116 |
static void checkCase1Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
117 |
StringBuilder sb = new StringBuilder(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
118 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
119 |
// Append index which means heap region index. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
120 |
sb.append(String.format("%6d", index)); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
121 |
sb.append("| .* | "); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
122 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
123 |
// Append page node id. |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
124 |
sb.append(memoryNodeIds[index]); |
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
125 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
126 |
output.shouldMatch(sb.toString()); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
127 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
128 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
129 |
// 3. +UseLargePages: large page size > G1HeapRegionSize |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
130 |
// |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
131 |
// As a OS page is consist of multiple heap regions, log also should be |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
132 |
// printed multiple times for same numa id. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
133 |
// e.g. 1MB heap region, 2MB page size and 2 NUMA nodes system |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
134 |
// Check the first set(4 regions) |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
135 |
// 0| ...omitted..| 0 |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
136 |
// 1| ...omitted..| 0 |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
137 |
// 2| ...omitted..| 1 |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
138 |
// 3| ...omitted..| 1 |
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
139 |
static void checkCase2Pattern(OutputAnalyzer output, int index, long g1HeapRegionSize, long actualPageSize, int[] memoryNodeIds) throws Exception { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
140 |
StringBuilder sb = new StringBuilder(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
141 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
142 |
// Append page range. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
143 |
int lines_to_print = (int)(actualPageSize / g1HeapRegionSize); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
144 |
for (int i = 0; i < lines_to_print; i++) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
145 |
// Append index which means heap region index. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
146 |
sb.append(String.format("%6d", index * lines_to_print + i)); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
147 |
sb.append("| .* | "); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
148 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
149 |
// Append page node id. |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
59060
diff
changeset
|
150 |
sb.append(memoryNodeIds[index]); |
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
151 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
152 |
output.shouldMatch(sb.toString()); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
153 |
sb.setLength(0); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
154 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
155 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
156 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
157 |
static void checkNUMALog(OutputAnalyzer output, int regionSizeInMB) throws Exception { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
158 |
WhiteBox wb = WhiteBox.getWhiteBox(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
159 |
long g1HeapRegionSize = regionSizeInMB * 1024 * 1024; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
160 |
long actualPageSize = heapPageSize(output); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
161 |
long defaultPageSize = (long)wb.getVMPageSize(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
162 |
int memoryNodeCount = wb.g1ActiveMemoryNodeCount(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
163 |
int[] memoryNodeIds = wb.g1MemoryNodeIds(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
164 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
165 |
System.out.println("node count=" + memoryNodeCount + ", actualPageSize=" + actualPageSize); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
166 |
// Check for the first set of active numa nodes. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
167 |
for (int index = 0; index < memoryNodeCount; index++) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
168 |
if (actualPageSize <= defaultPageSize) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
169 |
checkCase1Pattern(output, index, g1HeapRegionSize, actualPageSize, memoryNodeIds); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
170 |
} else { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
171 |
checkCase2Pattern(output, index, g1HeapRegionSize, actualPageSize, memoryNodeIds); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
172 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
173 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
174 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
175 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
176 |
static void testMemoryTouch(String largePagesSetting, int regionSizeInMB) throws Exception { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
177 |
// Skip testing with message. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
178 |
if (status == NUMASupportStatus.NOT_SUPPORT) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
179 |
System.out.println("NUMA is not supported"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
180 |
return; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
181 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
182 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
183 |
ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder( |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
184 |
"-Xbootclasspath/a:.", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
185 |
"-Xlog:pagesize,gc+heap+region=trace", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
186 |
"-XX:+UseG1GC", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
187 |
"-Xmx128m", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
188 |
"-Xms128m", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
189 |
"-XX:+UnlockDiagnosticVMOptions", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
190 |
"-XX:+WhiteBoxAPI", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
191 |
"-XX:+PrintFlagsFinal", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
192 |
"-XX:+UseNUMA", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
193 |
"-XX:+AlwaysPreTouch", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
194 |
largePagesSetting, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
195 |
"-XX:G1HeapRegionSize=" + regionSizeInMB + "m", |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
196 |
GCTest.class.getName()); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
197 |
OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start()); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
198 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
199 |
// Check NUMA availability. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
200 |
if (status == NUMASupportStatus.NOT_CHECKED) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
201 |
status = checkNUMAIsEnabled(output); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
202 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
203 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
204 |
if (status == NUMASupportStatus.SUPPORT) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
205 |
checkNUMALog(output, regionSizeInMB); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
206 |
} else { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
207 |
// Exit with message for the first test. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
208 |
System.out.println("NUMA is not supported"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
209 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
210 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
211 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
212 |
static class GCTest { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
213 |
public static final int M = 1024*1024; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
214 |
public static LinkedList<Object> garbageList = new LinkedList<Object>(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
215 |
// A large object referenced by a static. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
216 |
static int[] filler = new int[10 * M]; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
217 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
218 |
public static void genGarbage() { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
219 |
for (int i = 0; i < 32*1024; i++) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
220 |
garbageList.add(new int[100]); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
221 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
222 |
garbageList.clear(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
223 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
224 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
225 |
public static void main(String[] args) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
226 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
227 |
int[] large = new int[M]; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
228 |
Object ref = large; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
229 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
230 |
System.out.println("Creating garbage"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
231 |
for (int i = 0; i < 100; i++) { |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
232 |
// A large object that will be reclaimed eagerly. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
233 |
large = new int[6*M]; |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
234 |
genGarbage(); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
235 |
// Make sure that the compiler cannot completely remove |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
236 |
// the allocation of the large object until here. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
237 |
System.out.println(large); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
238 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
239 |
|
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
240 |
// Keep the reference to the first object alive. |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
241 |
System.out.println(ref); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
242 |
System.out.println("Done"); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
243 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
244 |
} |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff
changeset
|
245 |
} |