Bug 1866451 - Limit number of parallel IonFreeTasks to 1. r=jonco

These tasks are low-priority work and this should help avoid jemalloc lock contention.

Differential Revision: https://phabricator.services.mozilla.com/D194611
This commit is contained in:
Jan de Mooij 2023-11-24 12:45:35 +00:00
Родитель 20cbeea11f
Коммит cc5877f00b
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -191,6 +191,7 @@ class GlobalHelperThreadState {
const AutoLockHelperThreadState& lock) const;
size_t maxIonCompilationThreads() const;
size_t maxIonFreeThreads() const;
size_t maxWasmCompilationThreads() const;
size_t maxWasmTier2GeneratorThreads() const;
size_t maxPromiseHelperThreads() const;

Просмотреть файл

@ -1024,6 +1024,12 @@ size_t GlobalHelperThreadState::maxIonCompilationThreads() const {
return threadCount;
}
size_t GlobalHelperThreadState::maxIonFreeThreads() const {
// IonFree tasks are low priority. Limit to one thread to help avoid jemalloc
// lock contention.
return 1;
}
size_t GlobalHelperThreadState::maxWasmCompilationThreads() const {
if (IsHelperThreadSimulatingOOM(js::THREAD_TYPE_WASM_COMPILE_TIER1) ||
IsHelperThreadSimulatingOOM(js::THREAD_TYPE_WASM_COMPILE_TIER2)) {
@ -1238,7 +1244,8 @@ HelperThreadTask* GlobalHelperThreadState::maybeGetIonFreeTask(
bool GlobalHelperThreadState::canStartIonFreeTask(
const AutoLockHelperThreadState& lock) {
return !ionFreeList(lock).empty();
return !ionFreeList(lock).empty() &&
checkTaskThreadLimit(THREAD_TYPE_ION_FREE, maxIonFreeThreads(), lock);
}
jit::IonCompileTask* GlobalHelperThreadState::highestPriorityPendingIonCompile(