From 189ea856a7230ae3ce6a1cf5179145548188d434 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 26 Jul 2018 15:16:43 +0200 Subject: [PATCH] BUG/MEDIUM: tasks: use atomic ops for active_tasks_mask We don't have the lock anymore so we need to protect it. --- src/task.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/task.c b/src/task.c index edb528a..311660c 100644 --- a/src/task.c +++ b/src/task.c @@ -118,7 +118,7 @@ redo: return; } HA_ATOMIC_ADD(&tasks_run_queue, 1); - active_tasks_mask |= t->thread_mask; + HA_ATOMIC_OR(&active_tasks_mask, t->thread_mask); t->rq.key = HA_ATOMIC_ADD(&rqueue_ticks, 1); if (likely(t->nice)) { @@ -302,7 +302,7 @@ void process_runnable_tasks() return; } } - active_tasks_mask &= ~tid_bit; + HA_ATOMIC_AND(&active_tasks_mask, ~tid_bit); /* Get some tasks from the run queue, make sure we don't * get too much in the task list, but put a bit more than * the max that will be run, to give a bit more fairness @@ -381,7 +381,7 @@ void process_runnable_tasks() max_processed--; if (max_processed <= 0) { - active_tasks_mask |= tid_bit; + HA_ATOMIC_OR(&active_tasks_mask, tid_bit); activity[tid].long_rq++; break; } -- 1.7.10.4