From 3d95717b58be0902078e0693e383bc32ea3a715a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 2 Feb 2019 18:00:17 +0100 Subject: [PATCH] MINOR: threads: make use of thread_mask() to simplify some thread calculations By doing so it's visible that some fd_insert() calls were relying on MAX_THREADS while all_threads_mask should have been more suitable. --- src/cfgparse.c | 4 ++-- src/proto_sockpair.c | 3 +-- src/proto_tcp.c | 3 +-- src/proto_uxst.c | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 917fe0cae..3e8a7f5c3 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2287,8 +2287,8 @@ int check_config_validity() /* detect and address thread affinity inconsistencies */ nbproc = my_ffsl(proc_mask(bind_conf->bind_proc)) - 1; - mask = bind_conf->bind_thread[nbproc]; - if (mask && !(mask & all_threads_mask)) { + mask = thread_mask(bind_conf->bind_thread[nbproc]); + if (!(mask & all_threads_mask)) { unsigned long new_mask = 0; while (mask) { diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c index 068b24f60..9105dd2f9 100644 --- a/src/proto_sockpair.c +++ b/src/proto_sockpair.c @@ -153,8 +153,7 @@ static int sockpair_bind_listener(struct listener *listener, char *errmsg, int e listener->state = LI_LISTEN; fd_insert(fd, listener, listener->proto->accept, - listener->bind_conf->bind_thread[relative_pid-1] ? - listener->bind_conf->bind_thread[relative_pid-1] : MAX_THREADS_MASK); + thread_mask(listener->bind_conf->bind_thread[relative_pid-1])); return err; diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 52a4691d2..e4b8f63d7 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1076,8 +1076,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) listener->state = LI_LISTEN; fd_insert(fd, listener, listener->proto->accept, - listener->bind_conf->bind_thread[relative_pid-1] ? - listener->bind_conf->bind_thread[relative_pid-1] : MAX_THREADS_MASK); + thread_mask(listener->bind_conf->bind_thread[relative_pid-1])); tcp_return: if (msg && errlen) { diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 965b7cb84..7fc145b8c 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -340,8 +340,7 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle listener->state = LI_LISTEN; fd_insert(fd, listener, listener->proto->accept, - listener->bind_conf->bind_thread[relative_pid-1] ? - listener->bind_conf->bind_thread[relative_pid-1] : MAX_THREADS_MASK); + thread_mask(listener->bind_conf->bind_thread[relative_pid-1])); return err;