This aims at catching calls to task_unlink_wq() performed by the wrong
thread based on the shared status for the task, as well as calls to
__task_queue() with the wrong timer queue being used based on the task's
capabilities. This will at least help eliminate some hypothesis during
debugging sessions when suspecting that a wrong thread has attempted to
queue a task at the wrong place.
if (likely(task_in_wq(t))) {
locked = t->state & TASK_SHARED_WQ;
+ BUG_ON(!locked && t->thread_mask != tid_bit);
if (locked)
HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
__task_unlink_wq(t);
*/
void __task_queue(struct task *task, struct eb_root *wq)
{
+#ifdef USE_THREAD
+ BUG_ON((wq == &timers && !(task->state & TASK_SHARED_WQ)) ||
+ (wq == &sched->timers && (task->state & TASK_SHARED_WQ)) ||
+ (wq != &timers && wq != &sched->timers));
+#endif
+
if (likely(task_in_wq(task)))
__task_unlink_wq(task);