diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 6549a1e288695786dd81240c380fda12776439bf..9a2fb02702afcb6ec792b146a0ccfaf05b8bed6a 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -2716,6 +2716,10 @@ void CMSCollector::gc_epilogue(bool full) { bitMapLock()->unlock(); releaseFreelistLocks(); + if (!CleanChunkPoolAsync) { + Chunk::clean_chunk_pool(); + } + _between_prologue_and_epilogue = false; // ready for next cycle } diff --git a/src/share/vm/memory/defNewGeneration.cpp b/src/share/vm/memory/defNewGeneration.cpp index cbb6c38cfc31b5cc99e9e4d6bc44295053b2036a..c1a7051d78f480f64b9e8e5f30cb5969156cde3e 100644 --- a/src/share/vm/memory/defNewGeneration.cpp +++ b/src/share/vm/memory/defNewGeneration.cpp @@ -905,6 +905,10 @@ void DefNewGeneration::gc_epilogue(bool full) { to()->check_mangled_unused_area_complete(); } + if (!CleanChunkPoolAsync) { + Chunk::clean_chunk_pool(); + } + // update the generation and space performance counters update_counters(); gch->collector_policy()->counters()->update_counters(); diff --git a/src/share/vm/memory/genCollectedHeap.cpp b/src/share/vm/memory/genCollectedHeap.cpp index b9e4be40070b5edcef2177c43c776218ce5b950a..c1acb8d38933a42f26ba56f1c74df5c6732580b5 100644 --- a/src/share/vm/memory/genCollectedHeap.cpp +++ b/src/share/vm/memory/genCollectedHeap.cpp @@ -1384,6 +1384,10 @@ void GenCollectedHeap::gc_epilogue(bool full) { generation_iterate(&blk, false); // not old-to-young. perm_gen()->gc_epilogue(full); + if (!CleanChunkPoolAsync) { + Chunk::clean_chunk_pool(); + } + always_do_update_barrier = UseConcMarkSweepGC; }; diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index cfcd8ff728b8d09f4f6ac1f15f41c6d007187e30..be4991ab5394ac6bae6d583aaee474ab175ad5d4 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -444,6 +444,9 @@ class CommandLineFlags { product(bool, UsePPCLWSYNC, true, \ "Use lwsync instruction if true, else use slower sync") \ \ + develop(bool, CleanChunkPoolAsync, falseInEmbedded, \ + "Whether to clean the chunk pool asynchronously") \ + \ /* Temporary: See 6948537 */ \ experimental(bool, UseMemSetInBOT, true, \ "(Unstable) uses memset in BOT updates in GC code") \ diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 72a3f51f9a9f99e62e3919bccca141f89f416d77..efad706b1043bde8acaebaebca8e6c2fffea27a8 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -3347,7 +3347,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { // Notify JVMTI agents that VM initialization is complete - nop if no agents. JvmtiExport::post_vm_initialized(); - Chunk::start_chunk_pool_cleaner_task(); + if (CleanChunkPoolAsync) { + Chunk::start_chunk_pool_cleaner_task(); + } // initialize compiler(s) CompileBroker::compilation_init();