From: Olivier Houchard Date: Mon, 1 Jun 2026 16:17:50 +0000 (+0200) Subject: BUG/MINOR: tasks: Increase the right niced_task counter X-Git-Tag: v3.4.0~26 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=24455aa4e0879556ad330f8ae72675864d7a76a3;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/task.c b/src/task.c index ebce47da0..8d1bfdff1 100644 --- a/src/task.c +++ b/src/task.c @@ -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; }