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.
This commit is contained in:
Willy Tarreau 2022-06-16 15:52:49 +02:00
parent b17dd6cc19
commit da195e8aab
2 changed files with 1 additions and 12 deletions

View File

@ -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;

View File

@ -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;
}