BUG/MINOR: tasks: Increase the right niced_task counter

In __task_wakeup(), for a niced task, we don't always want to increase
the niced_task counter of the running thread's thread group, if we are
waking up the task of another thread, who belongs to a different thread
group, then we want to increment that thread group's counter instead, as
that's the one that will get decremented later.
So just increase the counter for the target thread'd thread group,
instead of using tg_ctx.
The impact is probably pretty minor, niced task shared amongst thread
are not very common, and the impact would mostly mean we'd run more/less
tasks in one run of process_runnable_tasks() than expected.
This should be backported as far as 2.8.
This commit is contained in:
Olivier Houchard 2026-06-01 18:17:50 +02:00 committed by Olivier Houchard
parent c0aa9f01f1
commit 24455aa4e0

View file

@ -237,7 +237,7 @@ void __task_wakeup(struct task *t)
if (likely(t->nice)) {
int offset;
_HA_ATOMIC_INC(&tg_ctx->niced_tasks);
_HA_ATOMIC_INC(&ha_thread_info[thr].tg_ctx->niced_tasks);
offset = t->nice * (int)global.tune.runqueue_depth;
t->rq.key += offset;
}