Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: src/heap/mark-compact.cc

Issue 1410163005: [heap] Use live memory as heuristic for spawning compaction tasks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added comment Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 96b10a4cbdde4050d21ec7b2dbd8bc1303d45c1e..e73dfc335481af7063d5b482a5d1c341d1521f7b 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -3311,12 +3311,20 @@ 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;
+ //
+ // TODO(mlippautz): Instead of basing the limit on live memory, we could also
+ // compute the number from the time it takes to evacuate memory and a given
+ // desired time in which compaction should be finished.
+ const int kLiveMemoryPerCompactionTask = 2 * Page::kPageSize;
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)));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698