afs: Skip bulkstat if stat cache looks full 56/13256/4
authorAndrew Deason <adeason@sinenomine.net>
Mon, 16 Jul 2018 21:53:34 +0000 (16:53 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 10 Jul 2020 05:16:27 +0000 (01:16 -0400)
Currently, afs_lookup() will try to prefetch dir entries for normal
dirs via bulkstat whenever multiple pids are reading that dir.
However, if we already have a lot of vcaches, ShakeLooseVCaches may be
struggling to limit the vcaches we already have. Entering
afs_DoBulkStat can make this worse, since we grab afs_xvcache
repeatedly, we may kick out other vcaches, and we'll possibly create
30 new vcaches that may not even be used before they're evicted.

To try to avoid this, skip running afs_DoBulkStat if it looks like the
stat cache is really full.

Change-Id: I1634530170a189f32cb962dd7df28f88bc758b71
Reviewed-on: https://gerrit.openafs.org/13256
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/VNOPS/afs_vnop_lookup.c

index 8534707..dd585e9 100644 (file)
@@ -1355,6 +1355,11 @@ afs_ShouldTryBulkStat(struct vcache *adp)
         * while we're doing a lookup. */
        return 0;
     }
+    if (afs_VCacheStressed()) {
+       /* If we already have too many vcaches, don't create more vcaches we
+        * may not even use. */
+       return 0;
+    }
     if ((adp->f.states & CForeign)) {
        /* Don't bulkstat for dfs xlator dirs. */
        return 0;