Commit 35563db2 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[compiler-dispatcher] Allow limiting the number of threads

Add a flag for controlling the maximum number of threads usable by the
LazyCompileDispatcher.

Change-Id: I87fc39d337a00cff0c3d152392630f48da050fff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3312482
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78214}
parent ba62172b
......@@ -35,8 +35,11 @@ class LazyCompileDispatcher::JobTask : public v8::JobTask {
}
size_t GetMaxConcurrency(size_t worker_count) const final {
return lazy_compile_dispatcher_->num_jobs_for_background_.load(
size_t n = lazy_compile_dispatcher_->num_jobs_for_background_.load(
std::memory_order_relaxed);
if (FLAG_lazy_compile_dispatcher_max_threads == 0) return n;
return std::min(
n, static_cast<size_t>(FLAG_lazy_compile_dispatcher_max_threads));
}
private:
......
......@@ -1578,6 +1578,8 @@ DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
// lazy-compile-dispatcher.cc
DEFINE_BOOL(lazy_compile_dispatcher, false, "enable compiler dispatcher")
DEFINE_UINT(lazy_compile_dispatcher_max_threads, 0,
"max threads for compiler dispatcher (0 for unbounded)")
DEFINE_BOOL(trace_compiler_dispatcher, false,
"trace compiler dispatcher activity")
DEFINE_BOOL(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment