afs: Flush vcaches sooner if cache is stressed

Currently, if the dynamic vcaches feature is enabled, the cache manager
deallocates batches of vcaches (allocated on demand) in the background.
Since this procedure is executed once every 5 minutes (at most), the
number of vcaches can grow unlimitedly between executions, increasing
the cost of using and maintaining them during this timeframe.

To prevent this from happening, run afs_ShakeLooseVCaches() sooner if we
have way more vcaches than the configured threshold.

Change-Id: I10ce7487441c659463ec85b4c8390274c11ef43f
Reviewed-on: https://gerrit.openafs.org/15044
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Marcio Barbosa 2022-07-05 19:34:47 +00:00 committed by Andrew Deason
parent 3f393cea96
commit 56d5ee3800

View File

@ -184,7 +184,8 @@ afs_Daemon(void)
last3MinCheck = now;
}
if (afsd_dynamic_vcaches && (last5MinCheck + 300 < now)) {
if (afsd_dynamic_vcaches && ((last5MinCheck + 300 < now) ||
afs_VCacheStressed())) {
/* start with trying to drop us back to our base usage */
int anumber = VCACHE_FREE + (afs_vcount - afs_cacheStats);