diff --git a/checkin_notes b/checkin_notes index 979666ae2a..58beb35108 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1408,3 +1408,11 @@ Charlie 11 Feb 2009 diagnostics.cpp mac_build/ Mac_SA_Secure.sh + +David 11 Feb 2009 + - client: change the formula for debt update + so that largest debt among eligible projects tends towards zero + - client: change definition of "overworked"; debt must be < 1 day + + client/ + work_fetch.cpp diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 8e65c43e41..71f108759d 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -136,7 +136,8 @@ void RSC_WORK_FETCH::update_estimated_delay(double dt) { // bool RSC_PROJECT_WORK_FETCH::overworked() { double x = gstate.work_buf_total() + gstate.global_prefs.cpu_scheduling_period(); - return (debt < -1.5*x); + if (x < 86400) x = 86400; + return (debt < -x); } // choose the best project to ask for work for this resource. @@ -395,10 +396,16 @@ void RSC_WORK_FETCH::update_debts() { } } if (!neligible) { + if (log_flags.debt_debug) { + msg_printf(0, MSG_INFO, + "[debt] %s: no eligible projects", rsc_name(rsc_type) + ); + } return; } - double delta_sum = 0; + double max_debt=0; + bool first = true; for (i=0; i max_debt) { + max_debt = w.debt; + } + } } } - // The sum of changes may be nonzero if - // - the resource wasn't fully utilized during the debt interval - // - it was overcommitted (e.g., CPU) - // Add an offset so that the sum of changes is zero; - // this keeps eligible projects from diverging from non-eligible ones. + // The net change may be + // - positive if the resource wasn't fully utilized during the debt interval + // - negative it was overcommitted (e.g., CPU) + // We need to keep eligible projects from diverging from non-eligible ones; + // also, if all the debts are large negative we need to gradually + // shift them towards zero. + // To do this, we add an offset as follows: // - double offset = delta_sum/neligible; - if (log_flags.debt_debug) { - msg_printf(0, MSG_INFO, "[debt] subtract %.2f for zero total change", offset); + double offset; + if (-max_debt < secs_this_debt_interval) { + offset = -max_debt; + } else { + offset = secs_this_debt_interval; + } + if (log_flags.debt_debug) { + msg_printf(0, MSG_INFO, "[debt] %s debt: adding offset %.2f", + rsc_name(rsc_type), offset + ); } - double max_debt = 0; for (i=0; inon_cpu_intensive) continue; RSC_PROJECT_WORK_FETCH& w = project_state(p); if (w.debt_eligible(p)) { - w.debt -= offset; + w.debt += offset; } - if (i) { - if (w.debt > max_debt) max_debt = w.debt; - } else { - max_debt = w.debt; - } - } - - // Add an offset so max debt is zero across all projects. - // This ensures that new projects start out debt-free. - // - if (log_flags.debt_debug) { - msg_printf(0, MSG_INFO, "[debt] subtract %.2f for zero max debt", max_debt); - } - for (i=0; inon_cpu_intensive) continue; - RSC_PROJECT_WORK_FETCH& w = project_state(p); - w.debt -= max_debt; } } @@ -506,10 +510,11 @@ void WORK_FETCH::compute_shares() { // bool RSC_PROJECT_WORK_FETCH::debt_eligible(PROJECT* p) { if (p->non_cpu_intensive) return false; - if (backoff_time > gstate.now) return false; - if (backoff_interval == MAX_BACKOFF_INTERVAL) return false; if (p->suspended_via_gui) return false; if (p->dont_request_more_work) return false; + if (has_runnable_jobs) return true; + if (backoff_time > gstate.now) return false; + if (backoff_interval == MAX_BACKOFF_INTERVAL) return false; if (p->min_rpc_time > gstate.now) return false; return true; }