mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
OPTIM: task: limit the impact of memory barriers in taks_remove_from_task_list()
In this function we end up with successive locked operations then a store barrier, and in addition the compiler has to emit less efficient code due to a longer jump. There's no need for absolutely updating the tasks_run_queue counter before clearing the task's leaf pointer, so let's swap the two operations and benefit from a single barrier as much as possible. This code is on the hot path and shows about half a percent of improvement with 8 threads.
This commit is contained in:
parent
bc6218e1b0
commit
1e56c70cc9
@ -273,11 +273,9 @@ static inline void task_remove_from_task_list(struct task *t)
|
|||||||
{
|
{
|
||||||
LIST_DEL_INIT(&((struct tasklet *)t)->list);
|
LIST_DEL_INIT(&((struct tasklet *)t)->list);
|
||||||
task_per_thread[tid].task_list_size--;
|
task_per_thread[tid].task_list_size--;
|
||||||
|
if (!TASK_IS_TASKLET(t))
|
||||||
|
HA_ATOMIC_STORE(&t->rq.node.leaf_p, NULL); // was 0x1
|
||||||
HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
HA_ATOMIC_SUB(&tasks_run_queue, 1);
|
||||||
if (!TASK_IS_TASKLET(t)) {
|
|
||||||
t->rq.node.leaf_p = NULL; // was 0x1
|
|
||||||
__ha_barrier_store();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user