From c61c28acef5caf4a8caca625a91bad19eac0ed7e Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Tue, 19 Feb 2013 08:53:58 +0000 Subject: [PATCH] scheduler: fix sending 'old' work in locality scheduler - leave locality scheduler only if there is no more work needed after sending 'old' work, in particular DON'T leave if old work for possibly non-locality apps couldn't be sent - try to send 'old' work before doing anything else --- sched/sched_locality.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sched/sched_locality.cpp b/sched/sched_locality.cpp index 478fcd96d5..c8c9eadc07 100644 --- a/sched/sched_locality.cpp +++ b/sched/sched_locality.cpp @@ -1169,6 +1169,16 @@ void send_work_locality() { ); } + // send old work if there is any. send this only to hosts which have + // high-bandwidth connections, since asking dial-up users to upload + // (presumably large) data files is onerous. + // + if (config.locality_scheduling_send_timeout && g_request->host.n_bwdown>100000) { + int until=time(0)-config.locality_scheduling_send_timeout; + int retval_sow=send_old_work(INT_MIN, until); + if (!work_needed(true)) return; + } + // Look for work in order of increasing file name, or randomly? // if (config.locality_scheduling_sorted_order) { @@ -1179,16 +1189,6 @@ void send_work_locality() { j = rand()%nfiles; } - // send old work if there is any. send this only to hosts which have - // high-bandwidth connections, since asking dial-up users to upload - // (presumably large) data files is onerous. - // - if (config.locality_scheduling_send_timeout && g_request->host.n_bwdown>100000) { - int until=time(0)-config.locality_scheduling_send_timeout; - int retval_sow=send_old_work(INT_MIN, until); - if (retval_sow==ERR_NO_APP_VERSION || retval_sow==ERR_INSUFFICIENT_RESOURCE) return; - } - // send work for existing files // for (i=0; i<(int)g_request->file_infos.size(); i++) {