MINOR: listener: move the nice field to the bind_conf

This is another bind line setting which can move to the bind_conf.
Note that it leaves a 2-byte hole in the listener struct.
This commit is contained in:
Willy Tarreau 2023-01-12 19:32:45 +01:00
parent d5983cef80
commit 7dbd4187dc
5 changed files with 9 additions and 10 deletions

View File

@ -206,6 +206,8 @@ struct bind_conf {
int (*accept)(struct connection *conn); /* upper layer's accept() */
int level; /* stats access level (ACCESS_LVL_*) */
int severity_output; /* default severity output format in cli feedback messages */
short int nice; /* nice value to assign to the instantiated tasks */
/* 2-byte hole here */
struct list listeners; /* list of listeners using this bind config */
uint32_t ns_cip_magic; /* Excepted NetScaler Client IP magic number */
struct list by_fe; /* next binding for the same frontend, or NULL */
@ -237,7 +239,7 @@ struct li_per_thread {
struct listener {
enum obj_type obj_type; /* object type = OBJ_TYPE_LISTENER */
enum li_state state; /* state: NEW, INIT, ASSIGNED, LISTEN, READY, FULL */
short int nice; /* nice value to assign to the instantiated tasks */
/* 2-byte hole here */
int luid; /* listener universally unique ID, used for SNMP */
int options; /* socket options : LI_O_* */
int flags; /* LI_F_* flags */

View File

@ -552,10 +552,10 @@ static int cli_parse_global(char **args, int section_type, struct proxy *curpx,
}
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
l->nice = -64; /* we want to boost priority for local stats */
global.maxsock++; /* for the listening socket */
}
}
@ -3045,12 +3045,12 @@ struct bind_conf *mworker_cli_proxy_new_listener(char *line)
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
/* don't make the peers subject to global limits and don't close it in the master */
l->options |= LI_O_UNLIMITED;
l->rx.flags |= RX_F_MWORKER; /* we are keeping this FD in the master */
l->nice = -64; /* we want to boost priority for local stats */
global.maxsock++; /* for the listening socket */
}
global.maxsock += mworker_proxy->maxconn;
@ -3112,13 +3112,13 @@ int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc)
ha_free(&path);
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
HA_ATOMIC_INC(&unstoppable_jobs);
/* it's a sockpair but we don't want to keep the fd in the master */
l->rx.flags &= ~RX_F_INHERITED;
l->nice = -64; /* we want to boost priority for local stats */
global.maxsock++; /* for the listening socket */
}

View File

@ -1742,7 +1742,6 @@ static int bind_parse_name(char **args, int cur_arg, struct proxy *px, struct bi
/* parse the "nice" bind keyword */
static int bind_parse_nice(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
struct listener *l;
int val;
if (!*args[cur_arg + 1]) {
@ -1756,9 +1755,7 @@ static int bind_parse_nice(char **args, int cur_arg, struct proxy *px, struct bi
return ERR_ALERT | ERR_FATAL;
}
list_for_each_entry(l, &conf->listeners, by_bind)
l->nice = val;
conf->nice = val;
return 0;
}

View File

@ -266,7 +266,7 @@ int session_accept_fd(struct connection *cli_conn)
goto out_free_sess;
sess->task->context = sess;
sess->task->nice = l->nice;
sess->task->nice = l->bind_conf->nice;
sess->task->process = session_expire_embryonic;
sess->task->expire = tick_add_ifset(now_ms, p->timeout.client);
task_queue(sess->task);

View File

@ -434,7 +434,7 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
t->context = s;
t->expire = TICK_ETERNITY;
if (sess->listener)
t->nice = sess->listener->nice;
t->nice = sess->listener->bind_conf->nice;
/* Note: initially, the stream's backend points to the frontend.
* This changes later when switching rules are executed or