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.
diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h
index 6edb52e..33d7541 100644
--- a/include/haproxy/listener-t.h
+++ b/include/haproxy/listener-t.h
@@ -206,6 +206,8 @@
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 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 */
diff --git a/src/cli.c b/src/cli.c
index 4b78fda..b133b5f 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -552,10 +552,10 @@
}
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 @@
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 @@
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 */
}
diff --git a/src/listener.c b/src/listener.c
index 86cf85c..1635576 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -1742,7 +1742,6 @@
/* 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 @@
return ERR_ALERT | ERR_FATAL;
}
- list_for_each_entry(l, &conf->listeners, by_bind)
- l->nice = val;
-
+ conf->nice = val;
return 0;
}
diff --git a/src/session.c b/src/session.c
index 2788c59..b15907d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -266,7 +266,7 @@
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);
diff --git a/src/stream.c b/src/stream.c
index 19e54b6..b01f44d 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -434,7 +434,7 @@
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