Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 96b10a4cbdde4050d21ec7b2dbd8bc1303d45c1e..e3b3cc007850f279602d0b3600288db1199fbb36 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -3311,12 +3311,16 @@ int MarkCompactCollector::NumberOfParallelCompactionTasks() { |
| if (!FLAG_parallel_compaction) return 1; |
| // We cap the number of parallel compaction tasks by |
| // - (#cores - 1) |
| - // - a value depending on the list of evacuation candidates |
| + // - a value depending on the live memory in evacuation candidates |
| // - a hard limit |
| - const int kPagesPerCompactionTask = 4; |
| + const int kLiveMemoryPerCompactionTask = 2 * Page::kPageSize; |
|
Hannes Payer (out of office)
2015/11/02 23:44:38
We could get a better bound here if we would use o
Michael Lippautz
2015/11/02 23:48:48
Done.
|
| const int kMaxCompactionTasks = 8; |
| + int live_bytes = 0; |
| + for (Page* page : evacuation_candidates_) { |
| + live_bytes += page->LiveBytes(); |
| + } |
| return Min(kMaxCompactionTasks, |
| - Min(1 + evacuation_candidates_.length() / kPagesPerCompactionTask, |
| + Min(1 + live_bytes / kLiveMemoryPerCompactionTask, |
| Max(1, base::SysInfo::NumberOfProcessors() - 1))); |
| } |