CLEANUP: task: only perform a LIST_DEL() when the list is not empty

In tasklet_free() we unconditionally perform a LIST_DEL() even when
the list is empty, let's move the LIST_DEL() inside the matching block.
This commit is contained in:
Willy Tarreau 2019-03-25 18:10:53 +01:00
parent e73256fd2a
commit a33d39a1b1

View File

@ -380,10 +380,10 @@ static inline void task_free(struct task *t)
static inline void tasklet_free(struct tasklet *tl) static inline void tasklet_free(struct tasklet *tl)
{ {
if (!LIST_ISEMPTY(&tl->list)) { if (!LIST_ISEMPTY(&tl->list)) {
LIST_DEL(&tl->list);
task_per_thread[tid].task_list_size--; task_per_thread[tid].task_list_size--;
_HA_ATOMIC_SUB(&tasks_run_queue, 1); _HA_ATOMIC_SUB(&tasks_run_queue, 1);
} }
LIST_DEL(&tl->list);
pool_free(pool_head_tasklet, tl); pool_free(pool_head_tasklet, tl);
if (unlikely(stopping)) if (unlikely(stopping))