From: Willy Tarreau Date: Thu, 26 Jul 2018 13:16:43 +0000 (+0200) Subject: BUG/MEDIUM: tasks: use atomic ops for active_tasks_mask X-Git-Tag: v1.9-dev1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=189ea856a7230ae3ce6a1cf5179145548188d434;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: tasks: use atomic ops for active_tasks_mask We don't have the lock anymore so we need to protect it. --- diff --git a/src/task.c b/src/task.c index edb528a102..311660cd64 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; }