mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-29 01:31:19 +02:00
BUG/MINOR: tasks: only requeue a task if it was already in the queue
Commit 0742c314c3 ("BUG/MEDIUM: tasks: Make sure we switch wait queues in task_set_affinity().") had a slight side effect on expired timeouts, which is that when used before a timeout is updated, it will cause an existing task to be requeued earlier than its expected timeout when done before being updated, resulting in the next poll wakup timeout too early or even instantly if the previous wake up was done on a timeout. This is visible in strace when health checks are enabled because there are two poll calls, one of which has a short or zero delay. The correct solution is to only requeue a task if it was already in the queue. This can be backported to all branches having the fix above.
This commit is contained in:
parent
4ac36d691a
commit
440d09b244
@ -155,12 +155,14 @@ static inline void task_wakeup(struct task *t, unsigned int f)
|
|||||||
/* change the thread affinity of a task to <thread_mask> */
|
/* change the thread affinity of a task to <thread_mask> */
|
||||||
static inline void task_set_affinity(struct task *t, unsigned long thread_mask)
|
static inline void task_set_affinity(struct task *t, unsigned long thread_mask)
|
||||||
{
|
{
|
||||||
if (task_in_wq(t))
|
if (unlikely(task_in_wq(t))) {
|
||||||
task_unlink_wq(t);
|
task_unlink_wq(t);
|
||||||
t->thread_mask = thread_mask;
|
t->thread_mask = thread_mask;
|
||||||
if (t->expire != TICK_ETERNITY)
|
|
||||||
task_queue(t);
|
task_queue(t);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
t->thread_mask = thread_mask;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unlink the task from the wait queue, and possibly update the last_timer
|
* Unlink the task from the wait queue, and possibly update the last_timer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user