From e0e490112c657134e432a3a10b1e71ff91e260e3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 22 Feb 2019 00:53:59 +0000 Subject: [PATCH] Link graph: Don't place jobs with different join dates in the same job set --- src/linkgraph/linkgraphschedule.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/linkgraph/linkgraphschedule.cpp b/src/linkgraph/linkgraphschedule.cpp index 5bc38a905f..a9b1d650e3 100644 --- a/src/linkgraph/linkgraphschedule.cpp +++ b/src/linkgraph/linkgraphschedule.cpp @@ -280,11 +280,12 @@ void LinkGraphJobGroup::JoinThread() { const uint thread_budget = 200000; std::sort(jobs.begin(), jobs.end(), [](const JobInfo &a, const JobInfo &b) { - return a.cost_estimate < b.cost_estimate; + return std::make_pair(a.job->JoinDateTicks(), a.cost_estimate) < std::make_pair(b.job->JoinDateTicks(), b.cost_estimate); }); std::vector bucket; uint bucket_cost = 0; + DateTicks bucket_join_date = 0; auto flush_bucket = [&]() { if (!bucket_cost) return; DEBUG(linkgraph, 2, "LinkGraphJobGroup::ExecuteJobSet: Creating Job Group: jobs: " PRINTF_SIZE ", cost: %u", bucket.size(), bucket_cost); @@ -295,7 +296,8 @@ void LinkGraphJobGroup::JoinThread() { }; for (JobInfo &it : jobs) { - if (bucket_cost && (bucket_cost + it.cost_estimate > thread_budget)) flush_bucket(); + if (bucket_cost && (bucket_join_date != it.job->JoinDateTicks() || (bucket_cost + it.cost_estimate > thread_budget))) flush_bucket(); + bucket_join_date = it.job->JoinDateTicks(); bucket.push_back(it.job); bucket_cost += it.cost_estimate; }