]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task/profiling: do not record task_drop_running() as a caller
authorWilly Tarreau <w@1wt.eu>
Fri, 24 Nov 2023 15:45:34 +0000 (16:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Nov 2023 10:24:52 +0000 (11:24 +0100)
Task_drop_running() is used to remove the RUNNING bit and check if
while the task was running it got a new wakeup from itself. Thus
each time task_drop_running() marks itself as a caller, it in fact
removes the previous caller that woke up the task, such as below:

Tasks activity over 10.439 sec till 0.000 sec ago:
  function                      calls   cpu_tot   cpu_avg   lat_tot   lat_avg
  task_run_applet            57895273   6.396m    6.628us   2.733h    170.0us <- run_tasks_from_lists@src/task.c:658 task_drop_running

Better not mark this function as a caller and keep the original one:

Tasks activity over 13.834 sec till 0.000 sec ago:
  function                      calls   cpu_tot   cpu_avg   lat_tot   lat_avg
  task_run_applet            62424582   5.825m    5.599us   5.717h    329.7us <- sc_app_chk_rcv_applet@src/stconn.c:952 appctx_wakeup

include/haproxy/task-t.h
include/haproxy/task.h

index 43f13e7b9cb442e464602f9740a0b52a00445fdb..ea52de9d1bed3fefe1ba8263921de8971b311ac5 100644 (file)
@@ -94,7 +94,6 @@ enum {
        WAKEUP_TYPE_TASK_INSTANT_WAKEUP,
        WAKEUP_TYPE_TASKLET_WAKEUP,
        WAKEUP_TYPE_TASKLET_WAKEUP_AFTER,
-       WAKEUP_TYPE_TASK_DROP_RUNNING,
        WAKEUP_TYPE_TASK_SCHEDULE,
        WAKEUP_TYPE_TASK_QUEUE,
        WAKEUP_TYPE_APPCTX_WAKEUP,
index df9e4ff7c55dd19c2057271a19d9973c871562a4..1c9c45f496ac751a9daa202ec3392b5d1629e50f 100644 (file)
@@ -229,10 +229,7 @@ static inline void _task_wakeup(struct task *t, unsigned int f, const struct ha_
  * that it's possible to unconditionally wakeup the task and drop the RUNNING
  * flag if needed.
  */
-#define task_drop_running(t, f) \
-       _task_drop_running(t, f, MK_CALLER(WAKEUP_TYPE_TASK_DROP_RUNNING, 0, 0))
-
-static inline void _task_drop_running(struct task *t, unsigned int f, const struct ha_caller *caller)
+static inline void task_drop_running(struct task *t, unsigned int f)
 {
        unsigned int state, new_state;
 
@@ -248,16 +245,8 @@ static inline void _task_drop_running(struct task *t, unsigned int f, const stru
                __ha_cpu_relax();
        }
 
-       if ((new_state & ~state) & TASK_QUEUED) {
-               if (likely(caller)) {
-                       caller = HA_ATOMIC_XCHG(&t->caller, caller);
-                       BUG_ON((ulong)caller & 1);
-#ifdef DEBUG_TASK
-                       HA_ATOMIC_STORE(&t->debug.prev_caller, caller);
-#endif
-               }
+       if ((new_state & ~state) & TASK_QUEUED)
                __task_wakeup(t);
-       }
 }
 
 /*
@@ -755,7 +744,6 @@ static inline const char *task_wakeup_type_str(uint t)
        case WAKEUP_TYPE_TASK_INSTANT_WAKEUP  : return "task_instant_wakeup";
        case WAKEUP_TYPE_TASKLET_WAKEUP       : return "tasklet_wakeup";
        case WAKEUP_TYPE_TASKLET_WAKEUP_AFTER : return "tasklet_wakeup_after";
-       case WAKEUP_TYPE_TASK_DROP_RUNNING    : return "task_drop_running";
        case WAKEUP_TYPE_TASK_QUEUE           : return "task_queue";
        case WAKEUP_TYPE_TASK_SCHEDULE        : return "task_schedule";
        case WAKEUP_TYPE_APPCTX_WAKEUP        : return "appctx_wakeup";