mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
BUG/MEDIUM: tasks: Make sure we modify global_tasks_mask with the rq_lock.
When modifying global_tasks_mask, make sure we hold the rq_lock, or we might remove the bit while it has been re-set by somebody else, and we make not be waked when needed.
This commit is contained in:
parent
b038007ae8
commit
de82aeaa26
@ -77,7 +77,7 @@ void __task_wakeup(struct task *t, struct eb_root *root)
|
|||||||
_HA_ATOMIC_ADD(&tasks_run_queue, 1);
|
_HA_ATOMIC_ADD(&tasks_run_queue, 1);
|
||||||
#ifdef USE_THREAD
|
#ifdef USE_THREAD
|
||||||
if (root == &rqueue) {
|
if (root == &rqueue) {
|
||||||
_HA_ATOMIC_OR(&global_tasks_mask, t->thread_mask);
|
global_tasks_mask |= t->thread_mask;
|
||||||
__ha_barrier_atomic_store();
|
__ha_barrier_atomic_store();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -302,8 +302,8 @@ void process_runnable_tasks()
|
|||||||
if (unlikely(!grq)) {
|
if (unlikely(!grq)) {
|
||||||
grq = eb32sc_first(&rqueue, tid_bit);
|
grq = eb32sc_first(&rqueue, tid_bit);
|
||||||
if (!grq) {
|
if (!grq) {
|
||||||
|
global_tasks_mask &= ~tid_bit;
|
||||||
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
|
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
|
||||||
_HA_ATOMIC_AND(&global_tasks_mask, ~tid_bit);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -335,8 +335,8 @@ void process_runnable_tasks()
|
|||||||
if (unlikely(!grq)) {
|
if (unlikely(!grq)) {
|
||||||
grq = eb32sc_first(&rqueue, tid_bit);
|
grq = eb32sc_first(&rqueue, tid_bit);
|
||||||
if (!grq) {
|
if (!grq) {
|
||||||
|
global_tasks_mask &= ~tid_bit;
|
||||||
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
|
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
|
||||||
_HA_ATOMIC_AND(&global_tasks_mask, ~tid_bit);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user