From b0efd7740243916ba22178524ab2ede9e5436d94 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 4 Jul 2024 12:42:47 +0000 Subject: [PATCH] 8314653: Metaspace: remove allocation guard feature Reviewed-by: azafari, dholmes --- .../share/memory/metaspace/metaspaceArena.cpp | 41 +---------- .../share/memory/metaspace/metaspaceArena.hpp | 24 +------ .../memory/metaspace/metaspaceSettings.cpp | 8 +-- .../memory/metaspace/metaspaceSettings.hpp | 6 +- src/hotspot/share/runtime/globals.hpp | 3 - .../gtest/metaspace/test_allocationGuard.cpp | 69 ------------------- .../gtest/metaspace/test_metaspacearena.cpp | 22 ------ .../metaspace/test_metaspacearena_stress.cpp | 4 +- test/hotspot/jtreg/gtest/MetaspaceGtests.java | 18 ++--- .../runtime/Metaspace/PrintMetaspaceDcmd.java | 13 +--- .../elastic/MetaspaceTestContext.java | 10 +-- .../runtime/Metaspace/elastic/Settings.java | 4 +- .../elastic/TestMetaspaceAllocation.java | 16 ++--- .../elastic/TestMetaspaceAllocationMT1.java | 23 +------ .../elastic/TestMetaspaceAllocationMT2.java | 23 +------ 15 files changed, 21 insertions(+), 263 deletions(-) delete mode 100644 test/hotspot/gtest/metaspace/test_allocationGuard.cpp diff --git a/src/hotspot/share/memory/metaspace/metaspaceArena.cpp b/src/hotspot/share/memory/metaspace/metaspaceArena.cpp index 8c5ebfed289..92d7d0ea7eb 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceArena.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceArena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -117,9 +117,6 @@ MetaspaceArena::MetaspaceArena(ChunkManager* chunk_manager, const ArenaGrowthPol _fbl(nullptr), _total_used_words_counter(total_used_words_counter), _name(name) -#ifdef ASSERT - , _first_fence(nullptr) -#endif { UL(debug, ": born."); @@ -128,14 +125,7 @@ MetaspaceArena::MetaspaceArena(ChunkManager* chunk_manager, const ArenaGrowthPol } MetaspaceArena::~MetaspaceArena() { -#ifdef ASSERT - SOMETIMES(verify();) - if (Settings::use_allocation_guard()) { - verify_allocation_guards(); - } -#endif MemRangeCounter return_counter; - Metachunk* c = _chunks.first(); Metachunk* c2 = nullptr; @@ -239,23 +229,6 @@ MetaWord* MetaspaceArena::allocate(size_t requested_word_size) { // Primary allocation p = allocate_inner(aligned_word_size); -#ifdef ASSERT - // Fence allocation - if (p != nullptr && Settings::use_allocation_guard()) { - STATIC_ASSERT(is_aligned(sizeof(Fence), BytesPerWord)); - MetaWord* guard = allocate_inner(sizeof(Fence) / BytesPerWord); - if (guard != nullptr) { - // Ignore allocation errors for the fence to keep coding simple. If this - // happens (e.g. because right at this time we hit the Metaspace GC threshold) - // we miss adding this one fence. Not a big deal. Note that his would - // be pretty rare. Chances are much higher the primary allocation above - // would have already failed). - Fence* f = new(guard) Fence(_first_fence); - _first_fence = f; - } - } -#endif // ASSERT - return p; } @@ -427,18 +400,6 @@ void MetaspaceArena::verify() const { } } -void MetaspaceArena::Fence::verify() const { - assert(_eye1 == EyeCatcher && _eye2 == EyeCatcher, - "Metaspace corruption: fence block at " PTR_FORMAT " broken.", p2i(this)); -} - -void MetaspaceArena::verify_allocation_guards() const { - assert(Settings::use_allocation_guard(), "Don't call with guards disabled."); - for (const Fence* f = _first_fence; f != nullptr; f = f->next()) { - f->verify(); - } -} - // Returns true if the area indicated by pointer and size have actually been allocated // from this arena. bool MetaspaceArena::is_valid_area(MetaWord* p, size_t word_size) const { diff --git a/src/hotspot/share/memory/metaspace/metaspaceArena.hpp b/src/hotspot/share/memory/metaspace/metaspaceArena.hpp index 58d80e97e17..77eb939c6b4 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceArena.hpp +++ b/src/hotspot/share/memory/metaspace/metaspaceArena.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -100,28 +100,6 @@ class MetaspaceArena : public CHeapObj { // A name for purely debugging/logging purposes. const char* const _name; -#ifdef ASSERT - // Allocation guards: When active, arena allocations are interleaved with - // fence allocations. An overwritten fence indicates a buffer overrun in either - // the preceding or the following user block. All fences are linked together; - // validating the fences just means walking that linked list. - // Note that for the Arena, fence blocks are just another form of user blocks. - class Fence { - static const uintx EyeCatcher = - NOT_LP64(0x77698465) LP64_ONLY(0x7769846577698465ULL); // "META" resp "METAMETA" - // Two eyecatchers to easily spot a corrupted _next pointer - const uintx _eye1; - const Fence* const _next; - NOT_LP64(uintx _dummy;) - const uintx _eye2; - public: - Fence(const Fence* next) : _eye1(EyeCatcher), _next(next), _eye2(EyeCatcher) {} - const Fence* next() const { return _next; } - void verify() const; - }; - const Fence* _first_fence; -#endif // ASSERT - ChunkManager* chunk_manager() const { return _chunk_manager; } // free block list diff --git a/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp b/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp index 7dc742755b6..b812341a2da 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,8 +36,6 @@ namespace metaspace { -DEBUG_ONLY(bool Settings::_use_allocation_guard = false;) - void Settings::ergo_initialize() { // Granules must be a multiple of page size, and a power-2-value. @@ -46,9 +44,6 @@ void Settings::ergo_initialize() { "Granule size must be a page-size-aligned power-of-2 value"); assert(commit_granule_words() <= chunklevel::MAX_CHUNK_WORD_SIZE, "Too large granule size"); - // Off for release builds, off by default - but switchable - for debug builds. - DEBUG_ONLY(_use_allocation_guard = MetaspaceGuardAllocations;) - LogStream ls(Log(metaspace)::info()); Settings::print_on(&ls); } @@ -58,7 +53,6 @@ void Settings::print_on(outputStream* st) { st->print_cr(" - commit_granule_words: " SIZE_FORMAT ".", commit_granule_words()); st->print_cr(" - virtual_space_node_default_size: " SIZE_FORMAT ".", virtual_space_node_default_word_size()); st->print_cr(" - enlarge_chunks_in_place: %d.", (int)enlarge_chunks_in_place()); - st->print_cr(" - use_allocation_guard: %d.", (int)use_allocation_guard()); } } // namespace metaspace diff --git a/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp b/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp index 93be0eb6fe6..84dcf8d2f0f 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp +++ b/src/hotspot/share/memory/metaspace/metaspaceSettings.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,9 +56,6 @@ class Settings : public AllStatic { // the requested size, we attempt to double the chunk size in place... static const bool _enlarge_chunks_in_place = true; - // If true, metablock allocations are guarded and periodically checked. - DEBUG_ONLY(static bool _use_allocation_guard;) - public: static size_t commit_granule_bytes() { return _commit_granule_bytes; } @@ -66,7 +63,6 @@ public: static size_t virtual_space_node_default_word_size() { return _virtual_space_node_default_word_size; } static size_t virtual_space_node_reserve_alignment_words() { return _virtual_space_node_reserve_alignment_words; } static bool enlarge_chunks_in_place() { return _enlarge_chunks_in_place; } - static bool use_allocation_guard() { return DEBUG_ONLY(_use_allocation_guard) NOT_DEBUG(false); } static void ergo_initialize(); diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 468e9bd8800..cbd161d86eb 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1408,9 +1408,6 @@ const int ObjectAlignmentInBytes = 8; product(bool, PrintMetaspaceStatisticsAtExit, false, DIAGNOSTIC, \ "Print metaspace statistics upon VM exit.") \ \ - develop(bool, MetaspaceGuardAllocations, false, \ - "Metapace allocations are guarded.") \ - \ product(uintx, MinHeapFreeRatio, 40, MANAGEABLE, \ "The minimum percentage of heap free after GC to avoid expansion."\ " For most GCs this applies to the old generation. In G1 and" \ diff --git a/test/hotspot/gtest/metaspace/test_allocationGuard.cpp b/test/hotspot/gtest/metaspace/test_allocationGuard.cpp deleted file mode 100644 index 9b0eb3d69a5..00000000000 --- a/test/hotspot/gtest/metaspace/test_allocationGuard.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020 SAP SE. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "memory/metaspace/metaspaceArena.hpp" -#include "memory/metaspace/metaspaceSettings.hpp" -#include "memory/metaspace/testHelpers.hpp" -#include "utilities/debug.hpp" -#include "utilities/ostream.hpp" - -//#define LOG_PLEASE -#include "metaspaceGtestCommon.hpp" -#include "metaspaceGtestContexts.hpp" - -#ifdef ASSERT - -using metaspace::MetaspaceArena; -using metaspace::MetaspaceTestArena; -using metaspace::Settings; - -// Test that overwriting memory triggers an assert if allocation guards are enabled. -// Note: We use TEST_VM_ASSERT_MSG. However, an assert is only triggered if allocation -// guards are enabled; if guards are disabled for the gtests, this test would fail. -// So for that case, we trigger a fake assert. -TEST_VM_ASSERT_MSG(metaspace, test_overwriter, ".*Metaspace corruption.*") { - - if (Settings::use_allocation_guard()) { - MetaspaceGtestContext context; - MetaspaceTestArena* arena = context.create_arena(Metaspace::StandardMetaspaceType); - // We allocate two blocks. We then write over the end of the first block, which - // should corrupt the fence between the two blocks. - // Note: there is of course no guarantee that blocks allocated sequentially are neighbors; - // but in this case (clean standard-sized test arena and very small allocations) it can - // be safely assumed). - MetaWord* p1 = arena->allocate(8); - MetaWord* p2 = arena->allocate(2); - p1[8] = (MetaWord)0x9345; // Overwriter - // Now we delete the arena (as happens during class unloading); this will check all - // block canaries and should trigger an assert (see MetaspaceArena::verify_allocation_guards()). - delete arena; - } else { - assert(false, "Metaspace corruption - please ignore this, fake message to satisfy tests"); - } - -} - -#endif // ASSERT diff --git a/test/hotspot/gtest/metaspace/test_metaspacearena.cpp b/test/hotspot/gtest/metaspace/test_metaspacearena.cpp index f7474da22c0..aee53ea32aa 100644 --- a/test/hotspot/gtest/metaspace/test_metaspacearena.cpp +++ b/test/hotspot/gtest/metaspace/test_metaspacearena.cpp @@ -291,11 +291,6 @@ TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_micro_nc) { // Here, we give it an ideal policy which should enable the initial chunk to grow unmolested // until finish. TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_2) { - - if (Settings::use_allocation_guard()) { - return; - } - // Note: internally, chunk in-place enlargement is disallowed if growing the chunk // would cause the arena to claim more memory than its growth policy allows. This // is done to prevent the arena to grow too fast. @@ -337,11 +332,6 @@ TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_2) { // test that in place enlargement correctly fails if growing the chunk would bring us // beyond the max. size of a chunk. TEST_VM(metaspace, MetaspaceArena_test_failing_to_enlarge_in_place_max_chunk_size) { - - if (Settings::use_allocation_guard()) { - return; - } - MetaspaceGtestContext context; for (size_t first_allocation_size = 1; first_allocation_size <= MAX_CHUNK_WORD_SIZE / 2; first_allocation_size *= 2) { @@ -372,11 +362,6 @@ TEST_VM(metaspace, MetaspaceArena_test_failing_to_enlarge_in_place_max_chunk_siz // test that in place enlargement correctly fails if growing the chunk would cause more // than doubling its size TEST_VM(metaspace, MetaspaceArena_test_failing_to_enlarge_in_place_doubling_chunk_size) { - - if (Settings::use_allocation_guard()) { - return; - } - MetaspaceGtestContext context; MetaspaceArenaTestHelper helper(context, Metaspace::StandardMetaspaceType, false); @@ -399,9 +384,6 @@ TEST_VM(metaspace, MetaspaceArena_test_failing_to_enlarge_in_place_doubling_chun // Allocate, deallocate, then allocate the same block again. The second allocate should // reuse the deallocated block. TEST_VM(metaspace, MetaspaceArena_deallocate) { - if (Settings::use_allocation_guard()) { - return; - } for (size_t s = 2; s <= MAX_CHUNK_WORD_SIZE; s *= 2) { MetaspaceGtestContext context; MetaspaceArenaTestHelper helper(context, Metaspace::StandardMetaspaceType, false); @@ -505,10 +487,6 @@ static void test_controlled_growth(Metaspace::MetaspaceType type, bool is_class, bool test_in_place_enlargement) { - if (Settings::use_allocation_guard()) { - return; - } - // From a MetaspaceArena in a clean room allocate tiny amounts; // watch it grow. Used/committed/capacity should not grow in // large jumps. Also, different types of MetaspaceArena should diff --git a/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp b/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp index 7d3df079802..e94f733e45b 100644 --- a/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp +++ b/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp @@ -106,15 +106,13 @@ class MetaspaceArenaTestBed : public CHeapObj { // - alignment/padding of allocations // - inside used counter contains blocks in free list // - free block list splinter threshold - // - if +MetaspaceGuardAllocations, guard costs // Since what we deallocated may have been given back to us in a following allocation, // we only know fore sure we allocated what we did not give back. const size_t at_least_allocated = _alloc_count.total_size() - _dealloc_count.total_size(); // At most we allocated this: - const size_t max_word_overhead_per_alloc = - 4 + (metaspace::Settings::use_allocation_guard() ? 4 : 0); + constexpr size_t max_word_overhead_per_alloc = 4; const size_t at_most_allocated = _alloc_count.total_size() + max_word_overhead_per_alloc * _alloc_count.count(); ASSERT_LE(at_least_allocated, in_use_stats._used_words - stats._free_blocks_word_size); diff --git a/test/hotspot/jtreg/gtest/MetaspaceGtests.java b/test/hotspot/jtreg/gtest/MetaspaceGtests.java index 4710c591029..f1f811d6a71 100644 --- a/test/hotspot/jtreg/gtest/MetaspaceGtests.java +++ b/test/hotspot/jtreg/gtest/MetaspaceGtests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,8 +25,8 @@ /* * Note: This runs the metaspace-related parts of gtest in configurations which - * are not tested explicitly in the standard gtests. - * + * are not tested explicitly in the standard gtest. Hence, there is no "default-ndebug" + * since that would be equivalent to the normal gtest for release builds. */ /* @test id=default-debug @@ -40,17 +40,7 @@ * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:VerifyMetaspaceInterval=1 */ -/* @test id=balanced-with-guards - * @summary Run metaspace-related gtests with allocation guards enabled - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.xml - * @requires vm.debug - * @requires vm.flagless - * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:VerifyMetaspaceInterval=1 -XX:+MetaspaceGuardAllocations - */ - -/* @test id=balanced-no-ccs +/* @test id=no-ccs * @summary Run metaspace-related gtests with compressed class pointers off * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java index 56d9c2095b2..42f22309d96 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java +++ b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, SAP and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,17 +36,6 @@ import jdk.test.lib.JDKToolFinder; * @run main/othervm -Dwith-compressed-class-space -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers PrintMetaspaceDcmd */ -/* - * @test id=test-64bit-ccs-guarded - * @summary Test the VM.metaspace command - * @requires vm.bits == "64" - * @requires vm.debug == true - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @run main/othervm -Dwith-compressed-class-space -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UnlockDiagnosticVMOptions -XX:+MetaspaceGuardAllocations PrintMetaspaceDcmd - */ - /* * @test id=test-64bit-noccs * @summary Test the VM.metaspace command diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestContext.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestContext.java index 5061c828c06..fe52317d4dd 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestContext.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestContext.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,17 +195,11 @@ public class MetaspaceTestContext { // - whatever we allocated // - deallocated blocks in fbl // - remains of retired chunks in fbl - // - overhead per allocation (padding for alignment, possibly allocation guards) + // - overhead per allocation (padding for alignment) // Overhead per allocation (see metaspaceArena.cpp, get_raw_allocation_word_size() ) // Any allocation is 3 words least expectedMaxUsage += (numAllocated * 3); - if (Settings.settings().usesAllocationGuards) { - // Guards need space. - expectedMaxUsage += (numAllocated * 2); - // Also, they disable the fbl, so deallocated still counts as used. - expectedMaxUsage += deallocatedWords; - } // Lets add a overhead per arena. Each arena carries a free block list containing // deallocated/retired blocks. We do not know how much. In general, the free block list should not diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java index c6d69f341b9..222ce44acc6 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,8 +27,6 @@ import jdk.test.whitebox.WhiteBox; public final class Settings { - public boolean usesAllocationGuards = WhiteBox.getWhiteBox().getBooleanVMFlag("MetaspaceGuardAllocations"); - final static long rootChunkWordSize = 2048 * 1024; static Settings theSettings; diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java index 1ecde3f8376..10d05a867fc 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,30 +27,22 @@ * @test id=debug * @bug 8251158 * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management + * @modules java.base/jdk.internal.misc java.management * @build jdk.test.whitebox.WhiteBox * @requires (vm.debug == true) - * * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:VerifyMetaspaceInterval=10 TestMetaspaceAllocation - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:VerifyMetaspaceInterval=10 -XX:+MetaspaceGuardAllocations TestMetaspaceAllocation - * */ /* * @test id=ndebug * @bug 8251158 * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management + * @modules java.base/jdk.internal.misc java.management * @build jdk.test.whitebox.WhiteBox * @requires (vm.debug == false) - * * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestMetaspaceAllocation + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestMetaspaceAllocation */ public class TestMetaspaceAllocation { diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java index 8bbab2c71e9..5676f2c4bdb 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ */ /* - * @test id=debug-default-strict + * @test id=debug-default-long-manual * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -74,24 +74,6 @@ * TestMetaspaceAllocationMT1 10 */ -/* - * @test id=debug-guard - * @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/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:VerifyMetaspaceInterval=10 - * -XX:+MetaspaceGuardAllocations - * TestMetaspaceAllocationMT1 3 - */ - /* * @test id=ndebug-default * @library /test/lib @@ -130,7 +112,6 @@ public class TestMetaspaceAllocationMT1 { System.out.println("#### seconds: " + seconds); System.out.println("#### commitLimit: " + commitLimit); System.out.println("#### reserveLimit: " + reserveLimit); - System.out.println("#### guards: " + Settings.settings().usesAllocationGuards); MetaspaceTestContext context = new MetaspaceTestContext(commitLimit, reserveLimit); MetaspaceTestOneArenaManyThreads test = new MetaspaceTestOneArenaManyThreads(context, testAllocationCeiling, numThreads, seconds); diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java index 17e3bb99353..2c6b3923d94 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ */ /* - * @test id=debug-default-strict + * @test id=debug-default-long-manual * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -74,24 +74,6 @@ * TestMetaspaceAllocationMT2 10 */ -/* - * @test id=debug-guard - * @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/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:VerifyMetaspaceInterval=10 - * -XX:+MetaspaceGuardAllocations - * TestMetaspaceAllocationMT2 3 - */ - /* * @test id=ndebug-default * @library /test/lib @@ -129,7 +111,6 @@ public class TestMetaspaceAllocationMT2 { System.out.println("#### seconds: " + seconds); System.out.println("#### commitLimit: " + commitLimit); System.out.println("#### reserveLimit: " + reserveLimit); - System.out.println("#### guards: " + Settings.settings().usesAllocationGuards); MetaspaceTestContext context = new MetaspaceTestContext(commitLimit, reserveLimit); MetaspaceTestManyArenasManyThreads test = new MetaspaceTestManyArenasManyThreads(context, testAllocationCeiling, numThreads, seconds);