]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: do not use __task_unlink_rq() from process_runnable_tasks()
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Feb 2021 06:14:58 +0000 (07:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Feb 2021 08:44:16 +0000 (09:44 +0100)
As indicated in previous commit, this function tries to guess which tree
the task is in to figure what counters to update, while we already have
that info in the caller. Let's just pick the relevant parts to place them
in the caller.

src/task.c

index dd3080f0db2cdd689e16380bff77ee5981d571d8..df6fbd5c0f6cb94e11b4be063aae5d98b3706d90 100644 (file)
@@ -701,14 +701,18 @@ void process_runnable_tasks()
                if (likely(!grq || (lrq && (int)(lrq->key - grq->key) <= 0))) {
                        t = eb32sc_entry(lrq, struct task, rq);
                        lrq = eb32sc_next(lrq, tid_bit);
-                       __task_unlink_rq(t);
+                       _HA_ATOMIC_SUB(&sched->rq_total, 1);
+                       eb32sc_delete(&t->rq);
                        lpicked++;
                }
 #ifdef USE_THREAD
                else {
                        t = eb32sc_entry(grq, struct task, rq);
                        grq = eb32sc_next(grq, tid_bit);
-                       __task_unlink_rq(t);
+                       grq_total--;
+                       _HA_ATOMIC_AND(&t->state, ~TASK_GLOBAL);
+                       eb32sc_delete(&t->rq);
+
                        if (unlikely(!grq)) {
                                grq = eb32sc_first(&rqueue, tid_bit);
                                if (!grq) {
@@ -719,6 +723,8 @@ void process_runnable_tasks()
                        gpicked++;
                }
 #endif
+               if (t->nice)
+                       _HA_ATOMIC_SUB(&niced_tasks, 1);
 
                /* Add it to the local task list */
                LIST_ADDQ(&tt->tasklets[TL_NORMAL], &((struct tasklet *)t)->list);