diff --git a/checkin_notes b/checkin_notes index 43cb543759..2456507d3f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6899,3 +6899,13 @@ David 14 Aug 2009 client/ work_fetch.cpp + +David 14 Aug 2009 + - client: in the final stage of CPU scheduling, + give preference to multi-threaded jobs. + Avoid running N-1 1-thread jobs and 1 N-thread job on N CPUs + - client: change file transfer giveup time from 14 to 90 days + + client/ + cpu_sched.cpp + pers_file_xfer.h diff --git a/client/cpu_sched.cpp b/client/cpu_sched.cpp index 8e72d2c70e..ecf8d61688 100644 --- a/client/cpu_sched.cpp +++ b/client/cpu_sched.cpp @@ -738,16 +738,44 @@ static inline bool in_ordered_scheduled_results(ACTIVE_TASK* atp) { // return true if r0 is more important to run than r1 // static inline bool more_important(RESULT* r0, RESULT* r1) { + // favor jobs in danger of deadline miss + // bool miss0 = r0->rr_sim_misses_deadline; bool miss1 = r1->rr_sim_misses_deadline; if (miss0 && !miss1) return true; if (!miss0 && miss1) return false; + + // favor coproc jobs, so that if we're RAM-limited + // we'll use the GPU instead of the CPU + // + bool cp0 = r0->uses_coprocs(); + bool cp1 = r1->uses_coprocs(); + if (cp0 && !cp1) return true; + if (!cp0 && cp1) return false; + + // favor multithreaded jobs over single-threaded, + // even if the latter haven't finished time slice. + // avoid the situation where we run N-1 ST jobs and 1 MT job on N CPUs + // + bool mt0 = (r0->avp->avg_ncpus > 1); + bool mt1 = (r1->avp->avg_ncpus > 1); + if (mt0 && !mt1) return true; + if (!mt0 && mt1) return false; + + // favor jobs in the middle of time slice + // bool unfin0 = r0->unfinished_time_slice; bool unfin1 = r1->unfinished_time_slice; if (unfin0 && !unfin1) return true; if (!unfin0 && unfin1) return false; + + // favor jobs selected first by schedule_cpus() + // (e.g., because their project has high debt) + // if (r0->seqno < r1->seqno) return true; if (r0->seqno > r1->seqno) return false; + + // tie breaker return (r0 < r1); } diff --git a/client/pers_file_xfer.h b/client/pers_file_xfer.h index 8393f5db76..f625ec1691 100644 --- a/client/pers_file_xfer.h +++ b/client/pers_file_xfer.h @@ -24,7 +24,7 @@ // Default values for exponential backoff #define PERS_RETRY_DELAY_MIN 60 // 1 minute #define PERS_RETRY_DELAY_MAX (60*60*4) // 4 hours -#define PERS_GIVEUP (60*60*24*7*2) // 2 weeks +#define PERS_GIVEUP (SECONDS_PER_DAY*90) // give up on xfer if this time elapses since last byte xferred /// PERS_FILE_XFER represents a "persistent file transfer",