From: Willy Tarreau Date: Thu, 16 Jun 2022 13:52:49 +0000 (+0200) Subject: MINOR: task: remove grq_total and use rq_total instead X-Git-Tag: v2.7-dev2~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da195e8aab0c0c81c70f9620948eff529159dda2;p=thirdparty%2Fhaproxy.git MINOR: task: remove grq_total and use rq_total instead grq_total was only used to know how many tasks were being queued in the global runqueue for stats purposes, and that was transferred to the per thread rq_total counter once assigned. We don't need this anymore since we know where they are, so let's just directly update rq_total and drop that one. --- diff --git a/include/haproxy/task.h b/include/haproxy/task.h index de54b1ce6f..4fb1fe31cf 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -90,7 +90,6 @@ /* a few exported variables */ extern volatile unsigned long global_tasks_mask; /* Mask of threads with tasks in the global runqueue */ -extern unsigned int grq_total; /* total number of entries in the global run queue, atomic */ extern unsigned int niced_tasks; /* number of niced tasks in the run queue */ extern struct pool_head *pool_head_task; @@ -147,9 +146,6 @@ static inline int total_run_queues() { int thr, ret = 0; -#ifdef USE_THREAD - ret = _HA_ATOMIC_LOAD(&grq_total); -#endif for (thr = 0; thr < global.nbthread; thr++) ret += _HA_ATOMIC_LOAD(&ha_thread_ctx[thr].rq_total); return ret; diff --git a/src/task.c b/src/task.c index b7678c15a4..f0ca126ceb 100644 --- a/src/task.c +++ b/src/task.c @@ -42,7 +42,6 @@ __decl_aligned_rwlock(wq_lock); /* RW lock related to the wait queue */ #ifdef USE_THREAD struct eb_root timers; /* sorted timers tree, global, accessed under wq_lock */ -unsigned int grq_total; /* total number of entries in the global run queue, atomic */ #endif @@ -233,7 +232,7 @@ void __task_wakeup(struct task *t) if (thr != tid) { root = &ha_thread_ctx[thr].rqueue_shared; - _HA_ATOMIC_INC(&grq_total); + _HA_ATOMIC_INC(&ha_thread_ctx[thr].rq_total); HA_SPIN_LOCK(TASK_RQ_LOCK, &ha_thread_ctx[thr].rqsh_lock); if (t->tid < 0) @@ -897,12 +896,6 @@ void process_runnable_tasks() if (lpicked + gpicked) { tt->tl_class_mask |= 1 << TL_NORMAL; _HA_ATOMIC_ADD(&tt->tasks_in_list, lpicked + gpicked); -#ifdef USE_THREAD - if (gpicked) { - _HA_ATOMIC_SUB(&grq_total, gpicked); - _HA_ATOMIC_ADD(&tt->rq_total, gpicked); - } -#endif activity[tid].tasksw += lpicked + gpicked; }