From ff1a391cedc2737aef4c49d26aea1305700b9b84 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 10 Aug 2012 18:29:00 +0000 Subject: [PATCH] - client: when we're making a scheduler RPC for a reason other than work fetch, and we're deciding whether to piggyback a work request, skip the checks for hysteresis (buffer < min) and for per-resource backoff time. These checks are there only to limit the rate of RPCs, which is not relevant since we're doing one any. This fixes a bug where a project w/ sporadic jobs specifies a next_rpc_delay to ensure regular polling from clients. When these polls occur they should request work regardless of backoff. svn path=/trunk/boinc/; revision=26002 --- checkin_notes | 17 ++++++++++++++++- client/work_fetch.cpp | 34 ++++++++++++++++++++++++++++------ client/work_fetch.h | 11 ++++++----- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index aa585503de..01b1dfd15f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5385,4 +5385,19 @@ Charlie 8 Aug 2012 clientgui/ DlgItemProperties.cpp - \ No newline at end of file + +David 10 Aug 2012 + - client: when we're making a scheduler RPC + for a reason other than work fetch, + and we're deciding whether to piggyback a work request, + skip the checks for hysteresis (buffer < min) + and for per-resource backoff time. + These checks are there only to limit the rate of RPCs, + which is not relevant since we're doing one any. + + This fixes a bug where a project w/ sporadic jobs specifies + a next_rpc_delay to ensure regular polling from clients. + When these polls occur they should request work regardless of backoff. + + client/ + work_fetch.cpp,h diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 4bf0b01ee2..127f30599a 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -171,11 +171,13 @@ RSC_PROJECT_WORK_FETCH& RSC_WORK_FETCH::project_state(PROJECT* p) { return p->rsc_pwf[rsc_type]; } +#if 0 bool RSC_WORK_FETCH::may_have_work(PROJECT* p) { if (dont_fetch(p, rsc_type)) return false; RSC_PROJECT_WORK_FETCH& w = project_state(p); return (w.backoff_time < gstate.now); } +#endif void RSC_WORK_FETCH::rr_init() { shortfall = 0; @@ -220,17 +222,37 @@ static bool wacky_dcf(PROJECT* p) { // If this resource is below min buffer level, // return the highest-priority project that may have jobs for it. // -PROJECT* RSC_WORK_FETCH::choose_project_hyst(bool enforce_hyst) { +// If strict is true, enforce hysteresis and backoff rules +// (which are there to limit rate of scheduler RPCs). +// Otherwise, we're going to do a scheduler RPC anyway +// and we're deciding whether to piggyback a work request, +// so there is no reason to enforce these rules. +// +PROJECT* RSC_WORK_FETCH::choose_project_hyst(bool strict) { PROJECT* pbest = NULL; - if (enforce_hyst) { + if (strict) { if (saturated_time > gstate.work_buf_min()) return NULL; } if (saturated_time > gstate.work_buf_total()) return NULL; for (unsigned i=0; ipwf.cant_fetch_work_reason) continue; - if (!project_state(p).may_have_work) continue; + + // check whether we can fetch work of this type + // + if (dont_fetch(p, rsc_type)) continue; + + // if strict, check backoff + // + if (strict) { + if (project_state(p).backoff_time > gstate.now) { + continue; + } + } // if project has zero resource share, // only fetch work if a device is idle @@ -626,7 +648,7 @@ PROJECT* WORK_FETCH::non_cpu_intensive_project_needing_work() { // choose a project to fetch work from, // and set the request fields of resource objects // -PROJECT* WORK_FETCH::choose_project(bool enforce_hyst) { +PROJECT* WORK_FETCH::choose_project(bool strict) { PROJECT* p; if (log_flags.work_fetch_debug) { @@ -659,12 +681,12 @@ PROJECT* WORK_FETCH::choose_project(bool enforce_hyst) { if (use_hyst_fetch) { if (gpus_usable) { for (int i=1; i