From b6e392ce2d661eaa3adeaed44e133da9d99f95f3 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 21 Jul 2024 15:25:42 +0530 Subject: evanix: don't use fcfs solver with --max_build --- src/evanix.c | 6 ++---- src/queue.c | 11 +++++++---- src/solver_util.c | 12 ------------ 3 files changed, 9 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/evanix.c b/src/evanix.c index 09fecb3..6721d4e 100644 --- a/src/evanix.c +++ b/src/evanix.c @@ -22,7 +22,7 @@ static const char usage[] = " -p, --pipelined Use evanix build pipeline.\n" " -l, --check_cache-status Perform cache locality check.\n" " -c, --close-unused-fd Close stderr on exec.\n" - " -k, --solver fcfs|greedy Solver to use.\n" + " -k, --solver greedy Solver to use.\n" "\n"; struct evanix_opts_t evanix_opts = { @@ -34,7 +34,7 @@ struct evanix_opts_t evanix_opts = { .system = NULL, .solver_report = false, .check_cache_status = true, - .solver = solver_fcfs, + .solver = solver_greedy, }; static int evanix_build_thread_create(struct build_thread *build_thread); @@ -165,8 +165,6 @@ int main(int argc, char *argv[]) case 'k': if (!strcmp(optarg, "greedy")) { evanix_opts.solver = solver_greedy; - } else if (!strcmp(optarg, "fcfs")) { - evanix_opts.solver = solver_fcfs; } else { fprintf(stderr, "option -%c has an invalid solver " diff --git a/src/queue.c b/src/queue.c index 98f3cf4..d53dc0d 100644 --- a/src/queue.c +++ b/src/queue.c @@ -103,11 +103,14 @@ int queue_pop(struct queue *queue, struct job **job) } pthread_mutex_lock(&queue->mutex); - ret = evanix_opts.solver(&j, &queue->jobs, queue->resources); - if (ret < 0) - goto out_mutex_unlock; - else if (evanix_opts.max_build) + if (evanix_opts.max_build) { + ret = evanix_opts.solver(&j, &queue->jobs, queue->resources); + if (ret < 0) + goto out_mutex_unlock; queue->resources -= ret; + } else { + j = CIRCLEQ_FIRST(&queue->jobs); + } ret = queue_dag_isolate(j, NULL, &queue->jobs, &queue->htab); if (ret < 0) goto out_mutex_unlock; diff --git a/src/solver_util.c b/src/solver_util.c index ec18f3c..5731c9a 100644 --- a/src/solver_util.c +++ b/src/solver_util.c @@ -99,15 +99,3 @@ out_free_jid: return ret; } - -int solver_fcfs(struct job **job, struct job_clist *q, - __attribute__((unused)) int32_t resources) -{ - if (CIRCLEQ_EMPTY(q)) { - print_err("%s", "Trying to pop from empty queue"); - return -ESRCH; - } - - *job = CIRCLEQ_FIRST(q); - return 0; -} -- cgit v1.2.3