MEDIUM: task/debug: move the ->thread_mask integrity checks to ->tid

Let's make sure the new ->tid field is always correct instead of checking
the thread mask.
This commit is contained in:
Willy Tarreau 2022-06-15 14:24:57 +02:00
parent 6ef52f4479
commit 5b8e054732
2 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ static inline int appctx_init(struct appctx *appctx)
* the appctx will be fully initialized. The session and the stream will
* eventually be created. The affinity must be set now !
*/
BUG_ON((appctx->t->thread_mask & tid_bit) == 0);
BUG_ON(appctx->t->tid != tid);
task_set_affinity(appctx->t, tid_bit);
if (appctx->applet->init)

View File

@ -279,7 +279,7 @@ static inline struct task *task_unlink_wq(struct task *t)
if (likely(task_in_wq(t))) {
locked = t->state & TASK_SHARED_WQ;
BUG_ON(!locked && t->thread_mask != tid_bit);
BUG_ON(!locked && t->tid != tid);
if (locked)
HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
__task_unlink_wq(t);
@ -318,7 +318,7 @@ static inline void task_queue(struct task *task)
} else
#endif
{
BUG_ON(task->thread_mask != tid_bit); // should have TASK_SHARED_WQ
BUG_ON(task->tid != tid); // should have TASK_SHARED_WQ
if (!task_in_wq(task) || tick_is_lt(task->expire, task->wq.key))
__task_queue(task, &th_ctx->timers);
}
@ -731,7 +731,7 @@ static inline void task_schedule(struct task *task, int when)
} else
#endif
{
BUG_ON((task->thread_mask & tid_bit) == 0); // should have TASK_SHARED_WQ
BUG_ON(task->tid != tid);
if (task_in_wq(task))
when = tick_first(when, task->expire);