]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tasks: use a less confusing name for task_list_size
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Feb 2021 13:13:40 +0000 (14:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Feb 2021 16:42:04 +0000 (17:42 +0100)
This one is systematically misunderstood due to its unclear name. It
is in fact the number of tasks in the local tasklet list. Let's call
it "tasks_in_list" to remove some of the confusion.

include/haproxy/task-t.h
src/debug.c
src/task.c

index 1a103a265a13d9ea8b35efdacb84a30367218796..b2a69ee18331ca33e7799ee76f06491461c41b09 100644 (file)
@@ -77,7 +77,7 @@ struct task_per_thread {
        struct mt_list shared_tasklet_list; /* Tasklet to be run, woken up by other threads */
        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 tasks_in_list;      /* Number of tasks in the per-thread tasklets list */
        int current_queue;      /* points to current tasklet list being run, -1 if none */
        unsigned int rq_total;  /* total size of the run queue, prio_tree + tasklets */
        struct task *current;   /* current task (not tasklet) */
index 3162d3282fade8d9219b57b3b8712b92a507d685..209199ab0c479d9d6b6b80422f16b065e0309750 100644 (file)
@@ -174,7 +174,7 @@ void ha_thread_dump(struct buffer *buf, int thr, int calling_tid)
                        LIST_ISEMPTY(&task_per_thread[thr].tasklets[TL_NORMAL]) &&
                        LIST_ISEMPTY(&task_per_thread[thr].tasklets[TL_BULK]) &&
                        MT_LIST_ISEMPTY(&task_per_thread[thr].shared_tasklet_list)),
-                     task_per_thread[thr].task_list_size,
+                     task_per_thread[thr].tasks_in_list,
                      task_per_thread[thr].rq_total,
                      stuck,
                      !!(task_profiling_mask & thr_bit));
index 6dffbdec1d90d2a7c86cca7147aaac566be6c372..028781755898d7733fb91a485ea37bdce32f429d 100644 (file)
@@ -97,7 +97,7 @@ void task_kill(struct task *t)
                        MT_LIST_ADDQ(&task_per_thread[thr].shared_tasklet_list,
                                     (struct mt_list *)&((struct tasklet *)t)->list);
                        _HA_ATOMIC_ADD(&task_per_thread[thr].rq_total, 1);
-                       _HA_ATOMIC_ADD(&task_per_thread[thr].task_list_size, 1);
+                       _HA_ATOMIC_ADD(&task_per_thread[thr].tasks_in_list, 1);
                        if (sleeping_thread_mask & (1UL << thr)) {
                                _HA_ATOMIC_AND(&sleeping_thread_mask, ~(1UL << thr));
                                wake_thread(thr);
@@ -485,7 +485,7 @@ unsigned int run_tasks_from_lists(unsigned int budgets[])
 
                /* OK then this is a regular task */
 
-               _HA_ATOMIC_SUB(&task_per_thread[tid].task_list_size, 1);
+               _HA_ATOMIC_SUB(&task_per_thread[tid].tasks_in_list, 1);
                if (unlikely(t->call_date)) {
                        uint64_t now_ns = now_mono_time();
                        uint64_t lat = now_ns - t->call_date;
@@ -631,7 +631,7 @@ void process_runnable_tasks()
        /* pick up to max[TL_NORMAL] regular tasks from prio-ordered run queues */
        /* Note: the grq lock is always held when grq is not null */
        picked = 0;
-       budget = max[TL_NORMAL] - tt->task_list_size;
+       budget = max[TL_NORMAL] - tt->tasks_in_list;
        while (picked < budget) {
                if ((global_tasks_mask & tid_bit) && !grq) {
 #ifdef USE_THREAD
@@ -693,7 +693,7 @@ void process_runnable_tasks()
 
        if (picked) {
                tt->tl_class_mask |= 1 << TL_NORMAL;
-               _HA_ATOMIC_ADD(&tt->task_list_size, picked);
+               _HA_ATOMIC_ADD(&tt->tasks_in_list, picked);
                _HA_ATOMIC_ADD(&tt->rq_total, picked);
                activity[tid].tasksw += picked;
        }