]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: remove tasklet_insert_into_tasklet_list()
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Nov 2020 14:30:22 +0000 (15:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Nov 2020 17:17:44 +0000 (18:17 +0100)
This function is only called at a single place and adds more confusion
than it removes. It also makes one think it could be used outside of
the scheduler while it must absolutely not. Let's just move its two
lines to the call place, making the code more readable there. In
addition this clearly shows that the preliminary LIST_INIT() is
useless since the entry is immediately overwritten.

include/haproxy/task.h
src/task.c

index 41885c2fc59e3eaaea0b996e4e5fe724151f527e..e4c93fc4aa2cc91f17b1640f93042261df828b3b 100644 (file)
@@ -369,15 +369,6 @@ static inline void tasklet_wakeup(struct tasklet *tl)
        tasklet_wakeup_on(tl, tl->tid);
 }
 
-/* Insert a tasklet into the tasklet list. If used with a plain task instead,
- * the caller must update the task_list_size.
- */
-static inline void tasklet_insert_into_tasklet_list(struct list *list, struct tasklet *tl)
-{
-       _HA_ATOMIC_ADD(&tasks_run_queue, 1);
-       LIST_ADDQ(list, &tl->list);
-}
-
 /* Remove the tasklet from the tasklet list. The tasklet MUST already be there.
  * If unsure, use tasklet_remove_from_tasklet_list() instead. If used with a
  * plain task, the caller must update the task_list_size.
index 325fd2e864a1606b71035d51353349b6bec78b89..8d574216f243432ab2b604ec1e54e1d8d0b90780 100644 (file)
@@ -660,10 +660,9 @@ void process_runnable_tasks()
                }
 #endif
 
-               /* Make sure the entry doesn't appear to be in a list */
-               LIST_INIT(&((struct tasklet *)t)->list);
-               /* And add it to the local task list */
-               tasklet_insert_into_tasklet_list(&tt->tasklets[TL_NORMAL], (struct tasklet *)t);
+               /* Add it to the local task list */
+               LIST_ADDQ(&tt->tasklets[TL_NORMAL], &((struct tasklet *)t)->list);
+               _HA_ATOMIC_ADD(&tasks_run_queue, 1);
                tt->tl_class_mask |= 1 << TL_NORMAL;
                _HA_ATOMIC_ADD(&tt->task_list_size, 1);
                activity[tid].tasksw++;