]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads/checks: Set the task process_mask when a check is executed
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Oct 2017 13:41:18 +0000 (15:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:33 +0000 (13:58 +0100)
Tasks used to process checks are created to be processed by any threads. But,
once a check is started, we must be sure to be sticky on the running thread
because I/O will be also sticky on it. This is a requirement for now: Tasks and
I/O handlers linked to the same session must be executed on the same thread.

src/checks.c

index cf1c59e4c0d767c7b41e40429b3ad4b745eaa940..0944c0e3bf579be73813ec39a057d3c45b2b4400 100644 (file)
@@ -1977,7 +1977,7 @@ static struct task *process_chk_proc(struct task *t)
                                int t_con = tick_add(now_ms, s->proxy->timeout.connect);
                                t->expire = tick_first(t->expire, t_con);
                        }
-
+                       task_set_affinity(t, tid_bit);
                        goto reschedule;
                }
 
@@ -2040,6 +2040,7 @@ static struct task *process_chk_proc(struct task *t)
                        /* a success was detected */
                        check_notify_success(check);
                }
+               task_set_affinity(t, MAX_THREADS_MASK);
                check->state &= ~CHK_ST_INPROGRESS;
 
                pid_list_del(check->curpid);
@@ -2114,6 +2115,7 @@ static struct task *process_chk_conn(struct task *t)
                        if (check->type)
                                conn_xprt_want_recv(conn);   /* prepare for reading a possible reply */
 
+                       task_set_affinity(t, tid_bit);
                        goto reschedule;
 
                case SF_ERR_SRVTO: /* ETIMEDOUT */
@@ -2205,6 +2207,7 @@ static struct task *process_chk_conn(struct task *t)
                        /* a success was detected */
                        check_notify_success(check);
                }
+               task_set_affinity(t, MAX_THREADS_MASK);
                check->state &= ~CHK_ST_INPROGRESS;
 
                rv = 0;