From 56efa3ec275ceef3f84f68e656f9e41e50ddf267 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 12 Nov 2009 17:19:50 +0000 Subject: [PATCH] - client: if a project has a no_{cpu,cuda,ati} pref set, don't accumulate debt for that resource. Otherwise we'll accumulate debt forever, pushing other projects into overworked state. svn path=/trunk/boinc/; revision=19547 --- checkin_notes | 9 +++++++++ client/work_fetch.cpp | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/checkin_notes b/checkin_notes index 083d06066d..5768bd5385 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9116,3 +9116,12 @@ David 11 Nov 2009 - tweaks to new credit simulator (from Kevin Reed) sched/ credit_test.cpp + +David 12 Nov 2009 + - client: if a project has a no_{cpu,cuda,ati} pref set, + don't accumulate debt for that resource. + Otherwise we'll accumulate debt forever, + pushing other projects into overworked state. + + client/ + work_fetch.cpp diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 61c411dd05..b79d9ea6a6 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -62,15 +62,20 @@ RSC_PROJECT_WORK_FETCH& RSC_WORK_FETCH::project_state(PROJECT* p) { } } -bool RSC_WORK_FETCH::may_have_work(PROJECT* p) { +inline bool prefs_prevent_fetch(PROJECT* p, int rsc_type) { switch(rsc_type) { case RSC_TYPE_CPU: - if (p->no_cpu_pref) return false; + if (p->no_cpu_pref) return true; case RSC_TYPE_CUDA: - if (p->no_cuda_pref) return false; + if (p->no_cuda_pref) return true; case RSC_TYPE_ATI: - if (p->no_ati_pref) return false; + if (p->no_ati_pref) return true; } + return false; +} + +bool RSC_WORK_FETCH::may_have_work(PROJECT* p) { + if (prefs_prevent_fetch(p, rsc_type)) return false; RSC_PROJECT_WORK_FETCH& w = project_state(p); return (w.backoff_time < gstate.now); } @@ -745,6 +750,13 @@ bool RSC_PROJECT_WORK_FETCH::debt_eligible(PROJECT* p, RSC_WORK_FETCH& rwf) { if (p->dont_request_more_work) return false; if (has_runnable_jobs) return true; if (backoff_time > gstate.now) return false; + if (prefs_prevent_fetch(p, rwf.rsc_type)) return false; + + // NOTE: it's critical that all conditions that might prevent + // us from asking the project for work of this type + // be included in the above list. + // Otherwise we might get in a state where debt accumulates, + // pushing other projects into overworked state // The last time we asked for work we didn't get any, // but it's been a while since we asked.