aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-21 15:25:42 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-21 15:25:42 +0530
commitb6e392ce2d661eaa3adeaed44e133da9d99f95f3 (patch)
tree87c946704ec595fd5e1fc2d8d4fae494ab8e5ade
parentc3c983087206a0598b2610eed4dde02f15a0036f (diff)
evanix: don't use fcfs solver with --max_build
-rw-r--r--include/solver_util.h2
-rw-r--r--src/evanix.c6
-rw-r--r--src/queue.c11
-rw-r--r--src/solver_util.c12
4 files changed, 9 insertions, 22 deletions
diff --git a/include/solver_util.h b/include/solver_util.h
index f1c8d41..08f7f16 100644
--- a/include/solver_util.h
+++ b/include/solver_util.h
@@ -15,8 +15,6 @@ struct jobid {
void jobid_free(struct jobid *jid);
int jobid_init(struct job_clist *q, struct jobid **job_ids);
-int solver_fcfs(struct job **job, struct job_clist *q,
- __attribute__((unused)) int32_t resources);
#define SOLVER_UTIL_H
#endif
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 <bool> Use evanix build pipeline.\n"
" -l, --check_cache-status <bool> Perform cache locality check.\n"
" -c, --close-unused-fd <bool> 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;
-}