Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cool down regulator after request to start GC is accepted #130

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ ShenandoahControlThread::ShenandoahControlThread() :
_alloc_failure_waiters_lock(Mutex::safepoint - 1, "ShenandoahAllocFailureGC_lock", true),
_gc_waiters_lock(Mutex::safepoint - 1, "ShenandoahRequestedGC_lock", true),
_control_lock(Mutex::nosafepoint - 1, "ShenandoahControlGC_lock", true),
_regulator_lock(Mutex::nosafepoint - 1, "ShenandoahRegulatorGC_lock", true),
_periodic_task(this),
_requested_gc_cause(GCCause::_no_cause_specified),
_requested_generation(GenerationMode::GLOBAL),
@@ -741,6 +742,8 @@ bool ShenandoahControlThread::request_concurrent_gc(GenerationMode generation) {
_requested_gc_cause = GCCause::_shenandoah_concurrent_gc;
_requested_generation = generation;
notify_control_thread();
MonitorLocker ml(&_regulator_lock, Mutex::_no_safepoint_check_flag);
ml.wait();
return true;
}

@@ -751,6 +754,8 @@ bool ShenandoahControlThread::request_concurrent_gc(GenerationMode generation) {
_preemption_requested.set();
ShenandoahHeap::heap()->cancel_gc(GCCause::_shenandoah_concurrent_gc);
notify_control_thread();
MonitorLocker ml(&_regulator_lock, Mutex::_no_safepoint_check_flag);
ml.wait();
return true;
}

@@ -929,5 +934,7 @@ void ShenandoahControlThread::set_gc_mode(ShenandoahControlThread::GCMode new_mo
if (_mode != new_mode) {
log_info(gc)("Transition from: %s to: %s", gc_mode_name(_mode), gc_mode_name(new_mode));
_mode = new_mode;
MonitorLocker ml(&_regulator_lock, Mutex::_no_safepoint_check_flag);
ml.notify_all();
}
}
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahControlThread.hpp
Original file line number Diff line number Diff line change
@@ -59,10 +59,11 @@ class ShenandoahControlThread: public ConcurrentGCThread {
private:
// While we could have a single lock for these, it may risk unblocking
// GC waiters when alloc failure GC cycle finishes. We want instead
// to make complete explicit cycle for for demanding customers.
// to make complete explicit cycle for demanding customers.
Monitor _alloc_failure_waiters_lock;
Monitor _gc_waiters_lock;
Monitor _control_lock;
Monitor _regulator_lock;
ShenandoahPeriodicTask _periodic_task;
ShenandoahPeriodicPacerNotify _periodic_pacer_notify_task;