MINOR: task: don't decrement then increment the local run queue
Now we don't need to decrement rq_total when we pick a tack in the tree
to immediately increment it again after installing it into the local
list. Instead, we simply add to the local queue count the number of
globally picked tasks. Avoiding this shows ~0.5% performance gains at
1Mreq/s (2M task switches/s).
diff --git a/src/task.c b/src/task.c
index df6fbd5..b205432 100644
--- a/src/task.c
+++ b/src/task.c
@@ -701,7 +701,6 @@
if (likely(!grq || (lrq && (int)(lrq->key - grq->key) <= 0))) {
t = eb32sc_entry(lrq, struct task, rq);
lrq = eb32sc_next(lrq, tid_bit);
- _HA_ATOMIC_SUB(&sched->rq_total, 1);
eb32sc_delete(&t->rq);
lpicked++;
}
@@ -739,7 +738,8 @@
if (lpicked + gpicked) {
tt->tl_class_mask |= 1 << TL_NORMAL;
_HA_ATOMIC_ADD(&tt->tasks_in_list, lpicked + gpicked);
- _HA_ATOMIC_ADD(&tt->rq_total, lpicked + gpicked);
+ if (gpicked)
+ _HA_ATOMIC_ADD(&tt->rq_total, gpicked);
activity[tid].tasksw += lpicked + gpicked;
}