mirror of
https://github.com/haproxy/haproxy.git
synced 2026-07-15 12:01:12 -04:00
CLEANUP: task: remove duplicated code in __tasklet_wakeup_after()
In the case where the task is first inserted (!head), the code is exactly __tasklet_wakeup_here(), so let's rely on this one. The profiling and rq_total parts are already handled there so let's move them to the head!=NULL branch.
This commit is contained in:
parent
0771f4757e
commit
c32bbd1ada
1 changed files with 4 additions and 24 deletions
28
src/task.c
28
src/task.c
|
|
@ -190,36 +190,16 @@ struct list *__tasklet_wakeup_after(struct list *head, struct tasklet *tl)
|
|||
{
|
||||
BUG_ON(tl->tid >= 0 && tid != tl->tid);
|
||||
|
||||
if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_TASK_PROFILING)
|
||||
tl->wake_date = now_mono_time();
|
||||
|
||||
/* this tasklet runs on the caller thread */
|
||||
if (!head) {
|
||||
if (tl->state & TASK_HEAVY) {
|
||||
LIST_INSERT(&th_ctx->tasklets[TL_HEAVY], &tl->list);
|
||||
th_ctx->tl_class_mask |= 1 << TL_HEAVY;
|
||||
}
|
||||
else if (tl->state & TASK_SELF_WAKING) {
|
||||
LIST_INSERT(&th_ctx->tasklets[TL_BULK], &tl->list);
|
||||
th_ctx->tl_class_mask |= 1 << TL_BULK;
|
||||
}
|
||||
else if ((struct task *)tl == th_ctx->current && !(tl->state & TASK_WOKEN_ANY)) {
|
||||
LIST_INSERT(&th_ctx->tasklets[TL_BULK], &tl->list);
|
||||
th_ctx->tl_class_mask |= 1 << TL_BULK;
|
||||
}
|
||||
else if (th_ctx->current_queue < 0) {
|
||||
LIST_INSERT(&th_ctx->tasklets[TL_URGENT], &tl->list);
|
||||
th_ctx->tl_class_mask |= 1 << TL_URGENT;
|
||||
}
|
||||
else {
|
||||
LIST_INSERT(&th_ctx->tasklets[TL_NORMAL], &tl->list);
|
||||
th_ctx->tl_class_mask |= 1 << TL_NORMAL;
|
||||
}
|
||||
__tasklet_wakeup_here(tl);
|
||||
}
|
||||
else {
|
||||
if (_HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_TASK_PROFILING)
|
||||
tl->wake_date = now_mono_time();
|
||||
LIST_APPEND(head, &tl->list);
|
||||
_HA_ATOMIC_INC(&th_ctx->rq_total);
|
||||
}
|
||||
_HA_ATOMIC_INC(&th_ctx->rq_total);
|
||||
return &tl->list;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue