OPTIM: task: limit the impact of memory barriers in taks_remove_from_task_list()
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Mar 2019 17:44:12 +0000 (18:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Mar 2019 17:44:12 +0000 (18:44 +0100)
commit1e56c70cc963177b8990edcb88a2896077de4c51
treecf6a8d337a4ac6bcd77bfee87e217a6fdbd90cea
parentbc6218e1b02860c6cdad0d2bb4dc8874557087f8
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.
include/proto/task.h