From 47c62d0ca35d3091a1a9f26e8bc5a9381f21253f Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Thu, 21 Feb 2013 09:37:40 -0800 Subject: [PATCH] Add extra break to avoid TRY_LATER loop running too long. --- src/plugins/sched/backfill/backfill.c | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c index 22d21c8b4e8..13bb5941bcf 100644 --- a/src/plugins/sched/backfill/backfill.c +++ b/src/plugins/sched/backfill/backfill.c @@ -727,7 +727,33 @@ static int _attempt_backfill(void) /* Determine impact of any resource reservations */ later_start = now; - TRY_LATER: FREE_NULL_BITMAP(avail_bitmap); + TRY_LATER: + if ((time(NULL) - sched_start) >= sched_timeout) { + uint32_t save_time_limit = job_ptr->time_limit; + job_ptr->time_limit = orig_time_limit; + if (debug_flags & DEBUG_FLAG_BACKFILL) { + END_TIMER; + info("backfill: completed yielding locks 2" + "after testing %d jobs, %s", + job_test_count, TIME_STR); + } + if (_yield_locks(1)) { + if (debug_flags & DEBUG_FLAG_BACKFILL) { + info("backfill: system state changed, " + "breaking out after testing %d " + "jobs", job_test_count); + } + rc = 1; + break; + } + job_ptr->time_limit = save_time_limit; + /* Reset backfill scheduling timers, resume testing */ + sched_start = time(NULL); + job_test_count = 1; + START_TIMER; + } + + FREE_NULL_BITMAP(avail_bitmap); FREE_NULL_BITMAP(exc_core_bitmap); start_res = later_start; later_start = 0; -- GitLab