From cf985929853ddf44c2b1263f8fc0d088b04434f6 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sun, 20 Mar 2022 11:05:03 +0100 Subject: [PATCH] mxqd_control: Add new users at tail of user list We are going to rely on the stability of the user list as a secondary preference criteria to the number of jobs running in the cluster. Put new user at the end of the user list so they start behind other waiting users and will stay behing them if the main crtieria (running_global_slot_count) is equal (e.g. zero). --- mxqd_control.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mxqd_control.c b/mxqd_control.c index 02fd76ee..47903673 100644 --- a/mxqd_control.c +++ b/mxqd_control.c @@ -435,8 +435,11 @@ struct mxq_group_list *_server_add_group(struct mxq_server *server, struct mxq_g ulist->server = server; - ulist->next = server->users; - server->users = ulist; + /* add new user at tail, so longer waiting users are preferred */ + struct mxq_user_list **lastptr = &server->users; + while (*lastptr) + lastptr = &(*lastptr)->next; + *lastptr = ulist; server->user_cnt++;