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).
This commit is contained in:
Willy Tarreau 2021-02-25 07:19:45 +01:00
parent 2b363ac092
commit c9afbb10f5

View File

@ -701,7 +701,6 @@ 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);
_HA_ATOMIC_SUB(&sched->rq_total, 1);
eb32sc_delete(&t->rq);
lpicked++;
}
@ -739,7 +738,8 @@ void process_runnable_tasks()
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;
}