mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8246476: remove AsyncDeflateIdleMonitors option and the safepoint based deflation mechanism
Reviewed-by: dholmes, pchilanomate, coleenp
This commit is contained in:
parent
231a8408b2
commit
7436ef236e
14 changed files with 144 additions and 630 deletions
|
@ -490,9 +490,6 @@ void SafepointSynchronize::end() {
|
|||
}
|
||||
|
||||
bool SafepointSynchronize::is_cleanup_needed() {
|
||||
// Need a cleanup safepoint if there are too many monitors in use
|
||||
// and the monitor deflation needs to be done at a safepoint.
|
||||
if (ObjectSynchronizer::is_safepoint_deflation_needed()) return true;
|
||||
// Need a safepoint if some inline cache buffers is non-empty
|
||||
if (!InlineCacheBuffer::is_empty()) return true;
|
||||
if (StringTable::needs_rehashing()) return true;
|
||||
|
@ -500,51 +497,24 @@ bool SafepointSynchronize::is_cleanup_needed() {
|
|||
return false;
|
||||
}
|
||||
|
||||
class ParallelSPCleanupThreadClosure : public ThreadClosure {
|
||||
private:
|
||||
DeflateMonitorCounters* _counters;
|
||||
|
||||
public:
|
||||
ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
|
||||
_counters(counters) {}
|
||||
|
||||
void do_thread(Thread* thread) {
|
||||
// deflate_thread_local_monitors() handles or requests deflation of
|
||||
// this thread's idle monitors. If !AsyncDeflateIdleMonitors or if
|
||||
// there is a special cleanup request, deflation is handled now.
|
||||
// Otherwise, async deflation is requested via a flag.
|
||||
ObjectSynchronizer::deflate_thread_local_monitors(thread, _counters);
|
||||
}
|
||||
};
|
||||
|
||||
class ParallelSPCleanupTask : public AbstractGangTask {
|
||||
private:
|
||||
SubTasksDone _subtasks;
|
||||
ParallelSPCleanupThreadClosure _cleanup_threads_cl;
|
||||
uint _num_workers;
|
||||
DeflateMonitorCounters* _counters;
|
||||
public:
|
||||
ParallelSPCleanupTask(uint num_workers, DeflateMonitorCounters* counters) :
|
||||
ParallelSPCleanupTask(uint num_workers) :
|
||||
AbstractGangTask("Parallel Safepoint Cleanup"),
|
||||
_subtasks(SafepointSynchronize::SAFEPOINT_CLEANUP_NUM_TASKS),
|
||||
_cleanup_threads_cl(ParallelSPCleanupThreadClosure(counters)),
|
||||
_num_workers(num_workers),
|
||||
_counters(counters) {}
|
||||
_num_workers(num_workers) {}
|
||||
|
||||
void work(uint worker_id) {
|
||||
uint64_t safepoint_id = SafepointSynchronize::safepoint_id();
|
||||
// All threads deflate monitors and mark nmethods (if necessary).
|
||||
Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
|
||||
const char* name = "deflating global idle monitors";
|
||||
const char* name = "deflating idle monitors";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
// AsyncDeflateIdleMonitors only uses DeflateMonitorCounters
|
||||
// when a special cleanup has been requested.
|
||||
// Note: This logging output will include global idle monitor
|
||||
// elapsed times, but not global idle monitor deflation count.
|
||||
ObjectSynchronizer::do_safepoint_work(_counters);
|
||||
ObjectSynchronizer::do_safepoint_work();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
|
@ -615,23 +585,17 @@ void SafepointSynchronize::do_cleanup_tasks() {
|
|||
|
||||
TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
|
||||
// Prepare for monitor deflation.
|
||||
DeflateMonitorCounters deflate_counters;
|
||||
ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
|
||||
|
||||
CollectedHeap* heap = Universe::heap();
|
||||
assert(heap != NULL, "heap not initialized yet?");
|
||||
WorkGang* cleanup_workers = heap->get_safepoint_workers();
|
||||
if (cleanup_workers != NULL) {
|
||||
// Parallel cleanup using GC provided thread pool.
|
||||
uint num_cleanup_workers = cleanup_workers->active_workers();
|
||||
ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
|
||||
StrongRootsScope srs(num_cleanup_workers);
|
||||
ParallelSPCleanupTask cleanup(num_cleanup_workers);
|
||||
cleanup_workers->run_task(&cleanup);
|
||||
} else {
|
||||
// Serial cleanup using VMThread.
|
||||
ParallelSPCleanupTask cleanup(1, &deflate_counters);
|
||||
StrongRootsScope srs(1);
|
||||
ParallelSPCleanupTask cleanup(1);
|
||||
cleanup.work(0);
|
||||
}
|
||||
|
||||
|
@ -644,9 +608,6 @@ void SafepointSynchronize::do_cleanup_tasks() {
|
|||
ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
|
||||
}
|
||||
|
||||
// Finish monitor deflation.
|
||||
ObjectSynchronizer::finish_deflate_idle_monitors(&deflate_counters);
|
||||
|
||||
assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue