]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] sched: don't leave 3 lasts tasks unprocessed when niced tasks are present
authorWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 10:53:09 +0000 (11:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 10:53:09 +0000 (11:53 +0100)
When there are niced tasks, we would only process #tasks/4 per
turn, without taking care of running #tasks when #tasks was below
4, leaving those tasks waiting for a few other tasks to push them.

The fix simply consists in checking (#tasks+3)/4.

src/task.c

index b4e2b97ca53ecd9fa8cc9640e7291400b1bac8b3..b46420a4a3158fb2560508b2adb928a5ffb646b2 100644 (file)
@@ -182,7 +182,7 @@ void process_runnable_tasks(int *next)
                max_processed = 200;
 
        if (likely(niced_tasks))
-               max_processed /= 4;
+               max_processed = (max_processed + 3) / 4;
 
        expire = *next;
        eb = eb32_lookup_ge(&rqueue, rqueue_ticks - TIMER_LOOK_BACK);