From b04ddec92daffc5c919b09def3998237ae10d4a0 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mar 17 2022 18:41:31 +0000 Subject: Revert "sanlock: Shrink thread pool when there is no work" This reverts commit 0ff9c1ab8852bec846822ee2af55ebcb7e5f5967. This patch causes unexplained growth in memory usage. Part of the problem may be that the worker threads are not joined and the detached state is not set, but an initial test setting the detached state didn't seem to fix the problem. --- diff --git a/src/main.c b/src/main.c index 613fb0e..b447b72 100644 --- a/src/main.c +++ b/src/main.c @@ -946,9 +946,6 @@ static void *thread_pool_worker(void *data) while (1) { while (!pool.quit && list_empty(&pool.work_data)) { - if (pool.free_workers >= DEFAULT_MIN_WORKER_THREADS) - goto out; - pool.free_workers++; pthread_cond_wait(&pool.cond, &pool.mutex); pool.free_workers--; @@ -969,7 +966,6 @@ static void *thread_pool_worker(void *data) break; } -out: pool.num_workers--; if (!pool.num_workers) pthread_cond_signal(&pool.quit_wait);