8205024: ZGC: Worker threads boost mode not always enabled when is should be
Reviewed-by: stefank, eosterlund
This commit is contained in:
parent
2f16dd96db
commit
8b9c9258aa
@ -146,6 +146,27 @@ static bool should_clear_soft_references() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool should_boost_worker_threads() {
|
||||||
|
// Boost worker threads if one or more allocations have stalled
|
||||||
|
const bool stalled = ZHeap::heap()->is_alloc_stalled();
|
||||||
|
if (stalled) {
|
||||||
|
// Boost
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boost worker threads if implied by the GC cause
|
||||||
|
const GCCause::Cause cause = ZCollectedHeap::heap()->gc_cause();
|
||||||
|
if (cause == GCCause::_wb_full_gc ||
|
||||||
|
cause == GCCause::_java_lang_system_gc ||
|
||||||
|
cause == GCCause::_metadata_GC_clear_soft_refs) {
|
||||||
|
// Boost
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't boost
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
class ZMarkStartClosure : public ZOperationClosure {
|
class ZMarkStartClosure : public ZOperationClosure {
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const {
|
virtual const char* name() const {
|
||||||
@ -164,6 +185,10 @@ public:
|
|||||||
const bool clear = should_clear_soft_references();
|
const bool clear = should_clear_soft_references();
|
||||||
ZHeap::heap()->set_soft_reference_policy(clear);
|
ZHeap::heap()->set_soft_reference_policy(clear);
|
||||||
|
|
||||||
|
// Setup boost mode
|
||||||
|
const bool boost = should_boost_worker_threads();
|
||||||
|
ZHeap::heap()->set_boost_worker_threads(boost);
|
||||||
|
|
||||||
ZCollectedHeap::heap()->increment_total_collections(true /* full */);
|
ZCollectedHeap::heap()->increment_total_collections(true /* full */);
|
||||||
|
|
||||||
ZHeap::heap()->mark_start();
|
ZHeap::heap()->mark_start();
|
||||||
@ -277,11 +302,6 @@ private:
|
|||||||
GCCauseSetter _gc_cause_setter;
|
GCCauseSetter _gc_cause_setter;
|
||||||
ZStatTimer _timer;
|
ZStatTimer _timer;
|
||||||
|
|
||||||
bool should_boost_worker_threads(GCCause::Cause cause) const {
|
|
||||||
return cause == GCCause::_java_lang_system_gc ||
|
|
||||||
cause == GCCause::_z_allocation_stall;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZDriverCycleScope(GCCause::Cause cause) :
|
ZDriverCycleScope(GCCause::Cause cause) :
|
||||||
_gc_id(),
|
_gc_id(),
|
||||||
@ -289,10 +309,6 @@ public:
|
|||||||
_timer(ZPhaseCycle) {
|
_timer(ZPhaseCycle) {
|
||||||
// Update statistics
|
// Update statistics
|
||||||
ZStatCycle::at_start();
|
ZStatCycle::at_start();
|
||||||
|
|
||||||
// Set boost mode
|
|
||||||
const bool boost = should_boost_worker_threads(cause);
|
|
||||||
ZHeap::heap()->set_boost_worker_threads(boost);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~ZDriverCycleScope() {
|
~ZDriverCycleScope() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user