]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[OPTIM] task: don't scan the run queue if we know it's empty
authorWilly Tarreau <w@1wt.eu>
Sat, 10 Sep 2011 18:08:49 +0000 (20:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 10 Sep 2011 18:08:49 +0000 (20:08 +0200)
It happens quite often in fact, so let's save those precious cycles.

src/task.c

index 9b21fd9df7e83fb46af8bc84372e8cbb98df2afc..a054150d25663891bf1af404e26cef8934a46f35 100644 (file)
@@ -196,6 +196,10 @@ void process_runnable_tasks(int *next)
        run_queue_cur = run_queue; /* keep a copy for reporting */
        nb_tasks_cur = nb_tasks;
        max_processed = run_queue;
+
+       if (!run_queue)
+               return;
+
        if (max_processed > 200)
                max_processed = 200;