Skip to content

Commit

Permalink
8303815: Improve Metaspace test speed
Browse files Browse the repository at this point in the history
Backport-of: de0e46c2f6dfa817bfa745195573810d250640de
  • Loading branch information
tstuefe committed Aug 28, 2023
1 parent 3f889a8 commit 89234bc
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 22 deletions.
4 changes: 2 additions & 2 deletions test/hotspot/gtest/metaspace/test_chunkManager_stress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class ChunkManagerRandomChunkAllocTest {

IntRange rand(100);

for (int j = 0; j < 1000; j++) {
for (int j = 0; j < 750; j++) {

bool force_alloc = false;
bool force_free = true;
Expand Down Expand Up @@ -249,7 +249,7 @@ class ChunkManagerRandomChunkAllocTest {
// {}

void do_tests() {
const int num_runs = 5;
const int num_runs = 3;
for (int n = 0; n < num_runs; n++) {
one_test();
}
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/gtest/metaspace/test_freeblocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class FreeBlocksTest {
bool forcefeed = false;
bool draining = false;
bool stop = false;
int iter = 100000; // safety stop
int iter = 25000; // safety stop
while (!stop && iter > 0) {
iter --;
int surprise = (int)os::random() % 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class MetaspaceArenaTest {
// - (rarely) deallocate (simulates metaspace deallocation, e.g. class redefinitions)
// - delete a test bed (simulates collection of a loader and subsequent return of metaspace to freelists)

const int iterations = 10000;
const int iterations = 2500;

// Lets have a ceiling on number of words allocated (this is independent from the commit limit)
const size_t max_allocation_size = 8 * M;
Expand Down
15 changes: 5 additions & 10 deletions test/hotspot/gtest/metaspace/test_virtualspacenode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class VirtualSpaceNodeTest {
TestMap testmap(c->word_size());
assert(testmap.get_num_set() == 0, "Sanity");

for (int run = 0; run < 1000; run++) {
for (int run = 0; run < 750; run++) {

const size_t committed_words_before = testmap.get_num_set();
ASSERT_EQ(_commit_limiter.committed_words(), committed_words_before);
Expand Down Expand Up @@ -425,7 +425,7 @@ class VirtualSpaceNodeTest {

assert(_commit_limit >= _vs_word_size, "No commit limit here pls");

// Allocate a root chunk and commit a random part of it. Then repeatedly split
// Allocate a root chunk and commit a part of it. Then repeatedly split
// it and merge it back together; observe the committed regions of the split chunks.

Metachunk* c = alloc_root_chunk();
Expand Down Expand Up @@ -562,15 +562,10 @@ TEST_VM(metaspace, virtual_space_node_test_2) {
}

TEST_VM(metaspace, virtual_space_node_test_3) {
double d = os::elapsedTime();
// Test committing uncommitting arbitrary ranges
for (int run = 0; run < 100; run++) {
VirtualSpaceNodeTest test(metaspace::chunklevel::MAX_CHUNK_WORD_SIZE,
metaspace::chunklevel::MAX_CHUNK_WORD_SIZE);
test.test_split_and_merge_chunks();
}
double d2 = os::elapsedTime();
LOG("%f", (d2-d));
VirtualSpaceNodeTest test(metaspace::chunklevel::MAX_CHUNK_WORD_SIZE,
metaspace::chunklevel::MAX_CHUNK_WORD_SIZE);
test.test_split_and_merge_chunks();
}

TEST_VM(metaspace, virtual_space_node_test_4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,24 @@
* @run main/othervm/timeout=400
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* TestMetaspaceAllocationMT1
* TestMetaspaceAllocationMT1 3
*/

/*
* @test id=debug-default-strict
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @build jdk.test.whitebox.WhiteBox
* @key randomness
* @requires (vm.debug == true)
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
*
* @run main/othervm/manual
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* TestMetaspaceAllocationMT1 10
*/

/*
Expand All @@ -72,7 +89,7 @@
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* -XX:+MetaspaceGuardAllocations
* TestMetaspaceAllocationMT1
* TestMetaspaceAllocationMT1 3
*/

/*
Expand All @@ -88,7 +105,7 @@
*
* @run main/othervm/timeout=400
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* TestMetaspaceAllocationMT1
* TestMetaspaceAllocationMT1 3
*/

public class TestMetaspaceAllocationMT1 {
Expand All @@ -97,7 +114,7 @@ public static void main(String[] args) throws Exception {

final long testAllocationCeiling = 1024 * 1024 * 8; // 8m words = 64M on 64bit
final int numThreads = 4;
final int seconds = 10;
final int seconds = Integer.parseInt(args[0]);

for (int i = 0; i < 3; i ++) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,24 @@
* @run main/othervm/timeout=400
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* TestMetaspaceAllocationMT2
* TestMetaspaceAllocationMT2 3
*/

/*
* @test id=debug-default-strict
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @build jdk.test.whitebox.WhiteBox
* @key randomness
* @requires (vm.debug == true)
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
*
* @run main/othervm/manual
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* TestMetaspaceAllocationMT2 10
*/

/*
Expand All @@ -72,7 +89,7 @@
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:VerifyMetaspaceInterval=10
* -XX:+MetaspaceGuardAllocations
* TestMetaspaceAllocationMT2
* TestMetaspaceAllocationMT2 3
*/

/*
Expand All @@ -88,7 +105,7 @@
*
* @run main/othervm/timeout=400
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* TestMetaspaceAllocationMT2
* TestMetaspaceAllocationMT2 3
*/

public class TestMetaspaceAllocationMT2 {
Expand All @@ -97,7 +114,7 @@ public static void main(String[] args) throws Exception {

final long testAllocationCeiling = 1024 * 1024 * 6; // 8m words = 64M on 64bit
final int numThreads = 4;
final int seconds = 10;
final int seconds = Integer.parseInt(args[0]);

for (int i = 0; i < 3; i ++) {

Expand Down

1 comment on commit 89234bc

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.