From 2333f6078aafe86826669b746969eb2433ee7963 Mon Sep 17 00:00:00 2001 From: "Antonio S. Musumeci" Date: Thu, 9 Apr 2026 23:32:47 -0400 Subject: [PATCH] Reset hill-climb direction after idle period MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When throughput dropped below 0.5 (idle), decline_streak was reset but direction was preserved. When work resumed, the monitor continued in whatever direction it held before the idle period — often a shrink direction that was correct for the previous workload but wrong for the new burst. This could cause the pool to shrink immediately when it should be growing. Reset direction to +1 (grow) when entering the idle branch so the pool starts the next active period biased toward growth, which is the safer default under new load. Co-Authored-By: Claude Opus 4.6 (1M context) --- vendored/libfuse/include/thread_pool.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vendored/libfuse/include/thread_pool.hpp b/vendored/libfuse/include/thread_pool.hpp index f60dc4be..0257a2d3 100644 --- a/vendored/libfuse/include/thread_pool.hpp +++ b/vendored/libfuse/include/thread_pool.hpp @@ -527,10 +527,14 @@ ThreadPool::monitor_routine(void *arg_) double prev_ema = ema_throughput; ema_throughput = ema_alpha * (double)raw_throughput + (1.0 - ema_alpha) * ema_throughput; - // Only adjust if there's meaningful work happening + // Only adjust if there's meaningful work happening. + // Reset direction to +1 (bias toward growth) so a stale + // shrink direction from before the idle period doesn't + // penalize the pool when work resumes. if(ema_throughput < 0.5 && prev_ema < 0.5) { decline_streak = 0; + direction = 1; continue; }