Commit 226da60f authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[v8] Do not do rely on hyper-threads for concurrent marking on Mac.

This should recover https://chromeperf.appspot.com/report?sid=4d751475ba95911f865aed7a822d55dde18304bc0cfd2f8409d1de9fe9695343
and https://arewefastyet.com/#machine=28&view=single&suite=octane&subtest=Splay

It will however regress this:
https://chromeperf.appspot.com/report?sid=020744195cfb20c373344b86b76385ce2919b53796b5c0651ba71c0625e8de19&start_rev=531511&end_rev=540262

R=ulan@chromium.org

Bug: chromium:812178, chromium:816541
Change-Id: Ia367d24b013c3f16d1dc2ae56d4c5ef23342845f
Reviewed-on: https://chromium-review.googlesource.com/946099Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51703}
parent 956ac923
......@@ -7,6 +7,7 @@
#include <stack>
#include <unordered_map>
#include "include/v8config.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
......@@ -506,8 +507,19 @@ void ConcurrentMarking::ScheduleTasks() {
base::LockGuard<base::Mutex> guard(&pending_lock_);
DCHECK_EQ(0, pending_task_count_);
if (task_count_ == 0) {
task_count_ = Max(
1, Min(kMaxTasks, V8::GetCurrentPlatform()->NumberOfWorkerThreads()));
static const int num_cores =
V8::GetCurrentPlatform()->NumberOfWorkerThreads() + 1;
#if defined(V8_OS_MACOSX)
// Mac OSX 10.11 and prior seems to have trouble when doing concurrent
// marking on competing hyper-threads (regresses Octane/Splay). As such,
// only use num_cores/2, leaving one of those for the main thread.
// TODO(ulan): Use all cores on Mac 10.12+.
task_count_ = Max(1, Min(kMaxTasks, (num_cores / 2) - 1));
#else // defined(OS_MACOSX)
// On other platforms use all logical cores, leaving one for the main
// thread.
task_count_ = Max(1, Min(kMaxTasks, num_cores - 1));
#endif // defined(OS_MACOSX)
}
// Task id 0 is for the main thread.
for (int i = 1; i <= task_count_; i++) {
......
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