!7924 add GC thread priority adjustment limit

Merge pull request !7924 from jinjiawei/master
This commit is contained in:
oh_ci 2024-06-26 11:08:10 +00:00 committed by Gitee
commit 3ef72274e4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -49,7 +49,9 @@ void PartialGC::RunPhases()
TRACE_GC(GCStats::Scope::ScopeId::TotalGC, gcStats);
MEM_ALLOCATE_AND_GC_TRACE(heap_->GetEcmaVM(), PartialGC_RunPhases);
bool mainThreadInForeground = heap_->GetJSThread()->IsMainThreadFast() && !heap_->IsInBackground();
if (mainThreadInForeground) {
bool needAjustGCThreadPrio = heap_->GetGCType() == TriggerGCType::OLD_GC ||
heap_->GetNewSpace()->GetCommittedSize() >= heap_->GetNewSpace()->GetMaximumCapacity();
if (mainThreadInForeground && needAjustGCThreadPrio) {
Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::STW);
}
markingInProgress_ = heap_->CheckOngoingConcurrentMarking();
@ -70,7 +72,7 @@ void PartialGC::RunPhases()
Verification::VerifyEvacuate(heap_);
}
Finish();
if (mainThreadInForeground) {
if (mainThreadInForeground && needAjustGCThreadPrio) {
Taskpool::GetCurrentTaskpool()->SetThreadPriority(PriorityMode::FOREGROUND);
}
if (heap_->IsConcurrentFullMark()) {