MINOR: task/profiling: do not record task_drop_running() as a caller

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
This commit is contained in:
Willy Tarreau 2023-11-24 16:45:34 +01:00
parent b4eaadae84
commit fc800b6cb7
2 changed files with 2 additions and 15 deletions

View File

@ -94,7 +94,6 @@ enum {
WAKEUP_TYPE_TASK_INSTANT_WAKEUP, WAKEUP_TYPE_TASK_INSTANT_WAKEUP,
WAKEUP_TYPE_TASKLET_WAKEUP, WAKEUP_TYPE_TASKLET_WAKEUP,
WAKEUP_TYPE_TASKLET_WAKEUP_AFTER, WAKEUP_TYPE_TASKLET_WAKEUP_AFTER,
WAKEUP_TYPE_TASK_DROP_RUNNING,
WAKEUP_TYPE_TASK_SCHEDULE, WAKEUP_TYPE_TASK_SCHEDULE,
WAKEUP_TYPE_TASK_QUEUE, WAKEUP_TYPE_TASK_QUEUE,
WAKEUP_TYPE_APPCTX_WAKEUP, WAKEUP_TYPE_APPCTX_WAKEUP,

View 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 * that it's possible to unconditionally wakeup the task and drop the RUNNING
* flag if needed. * flag if needed.
*/ */
#define task_drop_running(t, f) \ static inline void task_drop_running(struct task *t, unsigned int 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)
{ {
unsigned int state, new_state; 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(); __ha_cpu_relax();
} }
if ((new_state & ~state) & TASK_QUEUED) { 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
}
__task_wakeup(t); __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_TASK_INSTANT_WAKEUP : return "task_instant_wakeup";
case WAKEUP_TYPE_TASKLET_WAKEUP : return "tasklet_wakeup"; case WAKEUP_TYPE_TASKLET_WAKEUP : return "tasklet_wakeup";
case WAKEUP_TYPE_TASKLET_WAKEUP_AFTER : return "tasklet_wakeup_after"; 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_QUEUE : return "task_queue";
case WAKEUP_TYPE_TASK_SCHEDULE : return "task_schedule"; case WAKEUP_TYPE_TASK_SCHEDULE : return "task_schedule";
case WAKEUP_TYPE_APPCTX_WAKEUP : return "appctx_wakeup"; case WAKEUP_TYPE_APPCTX_WAKEUP : return "appctx_wakeup";