]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: task: only perform a LIST_DEL() when the list is not empty
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:10:53 +0000 (18:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:10:53 +0000 (18:10 +0100)
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.

include/proto/task.h

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