mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 00:27:08 +02:00
MINOR: tasks/debug: add a few BUG_ON() to detect use of wrong timer queue
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.
This commit is contained in:
parent
2447bce554
commit
e5d79bccc0
@ -221,6 +221,7 @@ static inline struct task *task_unlink_wq(struct task *t)
|
|||||||
|
|
||||||
if (likely(task_in_wq(t))) {
|
if (likely(task_in_wq(t))) {
|
||||||
locked = t->state & TASK_SHARED_WQ;
|
locked = t->state & TASK_SHARED_WQ;
|
||||||
|
BUG_ON(!locked && t->thread_mask != tid_bit);
|
||||||
if (locked)
|
if (locked)
|
||||||
HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
|
HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
|
||||||
__task_unlink_wq(t);
|
__task_unlink_wq(t);
|
||||||
|
@ -192,6 +192,12 @@ void __task_wakeup(struct task *t, struct eb_root *root)
|
|||||||
*/
|
*/
|
||||||
void __task_queue(struct task *task, struct eb_root *wq)
|
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)))
|
if (likely(task_in_wq(task)))
|
||||||
__task_unlink_wq(task);
|
__task_unlink_wq(task);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user