mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 01:16:30 -05:00
Enforce cooldown_usecs in monitor hill-climb loop
cooldown_usecs was only checked in _maybe_grow_on_pressure (the fast-path enqueue grow). The monitor thread scaled every sample_interval_usecs unconditionally, so a recent fast-path grow could be immediately followed by a monitor grow, defeating the cooldown. Check _last_scale_time_usecs against cooldown_usecs before applying any monitor scaling decision, making the cooldown global across both scaling paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2aa2311a55
commit
13fc1b27df
1 changed files with 9 additions and 0 deletions
|
|
@ -536,6 +536,15 @@ ThreadPool::monitor_routine(void *arg_)
|
|||
}
|
||||
}
|
||||
|
||||
// Respect the global cooldown so the monitor and fast-path
|
||||
// pressure grow don't step on each other.
|
||||
{
|
||||
std::uint64_t now = _now_usecs();
|
||||
std::uint64_t last = btp->_last_scale_time_usecs.load(std::memory_order_relaxed);
|
||||
if((now - last) < (std::uint64_t)btp->_scaling_config.cooldown_usecs)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(direction > 0 && count < btp->_scaling_config.max_threads)
|
||||
{
|
||||
btp->add_thread();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue