From d8b7a4701d1b01db5b0efc1de4227acfa9604d0f Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 16 Aug 2018 19:03:02 +0200 Subject: [PATCH] BUG/MEDIUM: tasks: Don't insert in the global rqueue if nbthread == 1 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/task.c b/src/task.c index de097baf7..e357bc169 100644 --- a/src/task.c +++ b/src/task.c @@ -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]);