In task_unlink_rq, to decide if we should logk the global runqueue lock,
use the TASK_GLOBAL flag instead of relying on t->thread_mask being tid_bit,
as it could be so while still being in the global runqueue if another thread
woke that task for us.
This should be backported to 1.9.
*/
static inline struct task *task_unlink_rq(struct task *t)
{
- if (t->thread_mask != tid_bit)
+ int is_global = t->state & TASK_GLOBAL;
+
+ if (is_global)
HA_SPIN_LOCK(TASK_RQ_LOCK, &rq_lock);
if (likely(task_in_rq(t))) {
if (&t->rq == rq_next)
rq_next = eb32sc_next(rq_next, tid_bit);
__task_unlink_rq(t);
}
- if (t->thread_mask != tid_bit)
+ if (is_global)
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
return t;
}