From 5c2636b743e6880b57e1903e26b1e231f5d7beef Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 2 Dec 2010 17:26:03 +0000 Subject: [PATCH] - client: fix scheduling bug. The round-robin simulation wasn't handling multithread jobs correctly. For example, given two 3-CPU jobs, it would model running them together on a 4-CPU host. This doesn't correspond with the CPU scheduler, which runs only 1 at a time. So the simulator would say that there are no idle CPUs when in fact there are, and no new CPU jobs would be fetched. svn path=/trunk/boinc/; revision=22801 --- checkin_notes | 13 +++++++++++++ client/rr_sim.cpp | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 9f18743099..f654e3f175 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8596,3 +8596,16 @@ Charlie 2 Dec 2010 PostInstall.cpp release_boinc.sh WaitPermissions.cpp + +David 2 Dec 2010 + - client: fix scheduling bug. + The round-robin simulation wasn't handling multithread jobs correctly. + For example, given two 3-CPU jobs, + it would model running them together on a 4-CPU host. + This doesn't correspond with the CPU scheduler, + which runs only 1 at a time. + So the simulator would say that there are no idle CPUs + when in fact there are, and no new CPU jobs would be fetched. + + client/ + rr_sim.cpp diff --git a/client/rr_sim.cpp b/client/rr_sim.cpp index 59f3c57224..550f5de7fe 100644 --- a/client/rr_sim.cpp +++ b/client/rr_sim.cpp @@ -290,7 +290,7 @@ void CLIENT_STATE::rr_simulation() { } } else { p->cpu_pwf.has_runnable_jobs = true; - if (p->cpu_pwf.sim_nused < ncpus) { + if (p->cpu_pwf.sim_nused + rp->avp->avg_ncpus <= ncpus) { sim_status.activate(rp, 0); p->rr_sim_status.activate(rp); } else { @@ -447,9 +447,9 @@ void CLIENT_STATE::rr_simulation() { } } else { while (1) { - if (pbest->cpu_pwf.sim_nused >= ncpus) break; RESULT* rp = pbest->rr_sim_status.get_pending(); if (!rp) break; + if (pbest->cpu_pwf.sim_nused + rp->avp->avg_ncpus > ncpus) break; sim_status.activate(rp, sim_now-now); pbest->rr_sim_status.activate(rp); }