]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] sched: permit a task to stay up between calls
authorWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 12:26:05 +0000 (13:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 12:26:05 +0000 (13:26 +0100)
If a task wants to stay in the run queue, it is possible. It just
needs to wake itself up. We just want to ensure that a reniced
task will be processed at the right instant.

src/task.c

index 17d825e595fd1bfe4ec5e8133324e9438e96b237..72e3a93e5c8171e21e9d23fc8a2e9e7b62ef0672 100644 (file)
@@ -225,6 +225,13 @@ void process_runnable_tasks(int *next)
                                task_queue(t);
                                expire = tick_first_2nz(expire, t->expire);
                        }
+
+                       /* if the task has put itself back into the run queue, we want to ensure
+                        * it will be served at the proper time, especially if it's reniced.
+                        */
+                       if (unlikely(task_in_rq(t)) && (!eb || tick_is_lt(t->rq.key, eb->key))) {
+                               eb = eb32_lookup_ge(&rqueue, rqueue_ticks - TIMER_LOOK_BACK);
+                       }
                }
        }
        *next = expire;