struct list tasklets[TL_CLASSES]; /* tasklets (and/or tasks) to run, by class */
unsigned int rqueue_ticks; /* Insertion counter for the run queue */
int task_list_size; /* Number of tasks among the tasklets */
- int rqueue_size; /* Number of elements in the per-thread run queue */
int current_queue; /* points to current tasklet list being run, -1 if none */
- struct task *current; /* current task (not tasklet) */
unsigned int rq_total; /* total size of the run queue, prio_tree + tasklets */
+ struct task *current; /* current task (not tasklet) */
uint8_t tl_class_mask; /* bit mask of non-empty tasklets classes */
__attribute__((aligned(64))) char end[0];
};
static inline int thread_has_tasks(void)
{
return (!!(global_tasks_mask & tid_bit) |
- (sched->rqueue_size > 0) |
+ !eb_is_empty(&sched->rqueue) |
!!sched->tl_class_mask |
!MT_LIST_ISEMPTY(&sched->shared_tasklet_list));
}
else
#endif
{
- sched->rqueue_size--;
_HA_ATOMIC_SUB(&sched->rq_total, 1);
}
eb32sc_delete(&t->rq);
if (root == &rqueue) {
_HA_ATOMIC_OR(&t->state, TASK_GLOBAL);
HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
- } else
-#endif
- {
- int nb = ((void *)root - (void *)&task_per_thread[0].rqueue) / sizeof(task_per_thread[0]);
- task_per_thread[nb].rqueue_size++;
}
-#ifdef USE_THREAD
+
/* If all threads that are supposed to handle this task are sleeping,
* wake one.
*/
if (unlikely(queue > TL_NORMAL &&
budget_mask & (1 << TL_NORMAL) &&
- ((sched->rqueue_size > 0) ||
+ (!eb_is_empty(&sched->rqueue) ||
(global_tasks_mask & tid_bit)))) {
/* a task was woken up by a bulk tasklet or another thread */
break;
/* normal tasklets list gets a default weight of ~37% */
if ((tt->tl_class_mask & (1 << TL_NORMAL)) ||
- (sched->rqueue_size > 0) || (global_tasks_mask & tid_bit))
+ !eb_is_empty(&sched->rqueue) || (global_tasks_mask & tid_bit))
max[TL_NORMAL] = default_weights[TL_NORMAL];
/* bulk tasklets list gets a default weight of ~13% */