]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: tasks: Don't insert in the global rqueue if nbthread == 1
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 16 Aug 2018 17:03:02 +0000 (19:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 16 Aug 2018 17:25:46 +0000 (19:25 +0200)
Make sure we don't insert a task in the global run queue if nbthread == 1,
as, as an optimisation, we avoid reading from it if nbthread == 1.

src/task.c

index de097baf7846220be62d46bd0a25ab8397922116..e357bc169a72aa56045219c3b14e6f0aae4eaba5 100644 (file)
@@ -395,7 +395,8 @@ void process_runnable_tasks()
                        state = HA_ATOMIC_AND(&t->state, ~TASK_RUNNING);
                        if (state)
 #ifdef USE_THREAD
-                               __task_wakeup(t, (t->thread_mask == tid_bit) ?
+                               __task_wakeup(t, (t->thread_mask == tid_bit ||
+                                   global.nbthread == 1) ?
                                    &rqueue_local[tid] : &rqueue);
 #else
                                __task_wakeup(t, &rqueue_local[tid]);