]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: release the task pool when stopping
authorWilly Tarreau <w@1wt.eu>
Thu, 13 Nov 2014 15:57:19 +0000 (16:57 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Nov 2014 15:57:19 +0000 (16:57 +0100)
When we're stopping, we're not going to create new tasks anymore, so
let's release the task pool upon each task_free() in order to reduce
memory fragmentation.

include/proto/task.h

index 46906704618af644547c047807ae1e480cf1c97d..35d77dacccde45b8556b15acd4275753e7e94013 100644 (file)
@@ -32,6 +32,7 @@
 #include <common/ticks.h>
 #include <eb32tree.h>
 
+#include <types/global.h>
 #include <types/task.h>
 
 /* Principle of the wait queue.
@@ -199,6 +200,8 @@ static inline struct task *task_new(void)
 static inline void task_free(struct task *t)
 {
        pool_free2(pool2_task, t);
+       if (unlikely(stopping))
+               pool_flush2(pool2_task);
        nb_tasks--;
 }