From 3961608f63691a09ade587f9acb7f5abf7570f91 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 16 Jun 2022 15:36:58 +0200 Subject: [PATCH] CLEANUP: task: remove the unused task_unlink_rq() This function stopped being used before 2.4 because either the task is dequeued by the scheduler itself and it knows where to find it, or it's killed by any thread, and task_kill() must be used for this as only this one is safe. It's difficult to say whether task_unlink_rq() is still safe, but once the lock moves to a thread declared in the task itself, it will be even more difficult to keep it safe. Let's just remove it now before someone reuses it and causes trouble. --- include/haproxy/task.h | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/include/haproxy/task.h b/include/haproxy/task.h index d1613c047d..58910fe717 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -350,41 +350,6 @@ static inline void task_set_thread(struct task *t, int thr) } } -/* - * Unlink the task from the run queue if it's in it. The run queue size and - * number of niced tasks are updated too. A pointer to the task itself is - * returned. If the task is in the global run queue, the global run queue's - * lock will be used during the operation. - */ -static inline struct task *task_unlink_rq(struct task *t) -{ - int is_global = t->state & TASK_GLOBAL; - int done = 0; - - if (is_global) - HA_SPIN_LOCK(TASK_RQ_LOCK, &rq_lock); - - if (likely(task_in_rq(t))) { - eb32sc_delete(&t->rq); - done = 1; - } - - if (is_global) - HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock); - - if (done) { - if (is_global) { - _HA_ATOMIC_AND(&t->state, ~TASK_GLOBAL); - _HA_ATOMIC_DEC(&grq_total); - } - else - _HA_ATOMIC_DEC(&th_ctx->rq_total); - if (t->nice) - _HA_ATOMIC_DEC(&niced_tasks); - } - return t; -} - /* schedules tasklet to run onto thread or the current thread if * is negative. Note that it is illegal to wakeup a foreign tasklet if * its tid is negative and it is illegal to self-assign a tasklet that was -- 2.47.3