]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: tasks: make sure the first task to be queued keeps its nice value
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Apr 2019 13:18:37 +0000 (15:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Apr 2019 13:54:02 +0000 (15:54 +0200)
commit587a8130b129053cc9b402474004e7de4c3d79ac
treeb15abb8af375b17481f43615216b19bb54c625d6
parentf8bce3125ef44fe599ad8793c85ed3a65ee08642
BUG/MINOR: tasks: make sure the first task to be queued keeps its nice value

The run queue offset computed from the nice value depends on the run
queue size, but for the first task to enter the run queue, this size
is zero and the task gets queued just as if its nice value was zero as
well. This is problematic for example for the CLI socket if another
higher priority task gets queued immediately after as it can steal its
place.

This patch simply adds one to the rq_size value to make sure the nice
is never multiplied by zero. The way the offset is calculated is
questionable anyway these days, since with the newer scheduler it seems
that just using the nice value as an offset should work (possibly damped
by the task's number of calls).

This fix must be backported to 1.9. It may possibly be backported to
older versions if it proves to make the CLI more interactive.
src/task.c