]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: task: remove the unused task_unlink_rq()
authorWilly Tarreau <w@1wt.eu>
Thu, 16 Jun 2022 13:36:58 +0000 (15:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
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

index d1613c047d7b0dce7c4213fe46062fca8f945dc0..58910fe7172a18d8947b776feed6cd1e0834d4ea 100644 (file)
@@ -350,41 +350,6 @@ static inline void task_set_thread(struct task *t, int thr)
        }
 }
 
-/*
- * Unlink the task <t> 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 <tl> to run onto thread <thr> or the current thread if
  * <thr> 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