cache: ignore purgevfs requests for filesystems with few vnodes
purgevfs is purely optional and induces lock contention in workloads which frequently mount and unmount filesystems. In particular, poudriere will do this for filesystems with 4 vnodes or less. Full cache scan is clearly wasteful. Since there is no explicit counter for namecache entries, the number of vnodes used by the target fs is checked. The default limit is the number of bucket locks. Reviewed by: kib
This commit is contained in:
parent
b78bd5ec30
commit
4876636eb7
@ -207,6 +207,9 @@ SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0,
|
||||
u_int ncsizefactor = 2;
|
||||
SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0,
|
||||
"Size factor for namecache");
|
||||
static u_int ncpurgeminvnodes;
|
||||
SYSCTL_UINT(_vfs, OID_AUTO, ncpurgeminvnodes, CTLFLAG_RW, &ncpurgeminvnodes, 0,
|
||||
"Number of vnodes below which purgevfs ignores the request");
|
||||
|
||||
struct nchstats nchstats; /* cache effectiveness statistics */
|
||||
|
||||
@ -1614,6 +1617,7 @@ nchinit(void *dummy __unused)
|
||||
M_WAITOK | M_ZERO);
|
||||
for (i = 0; i < numvnodelocks; i++)
|
||||
mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE);
|
||||
ncpurgeminvnodes = numbucketlocks;
|
||||
|
||||
numcalls = counter_u64_alloc(M_WAITOK);
|
||||
dothits = counter_u64_alloc(M_WAITOK);
|
||||
@ -1764,6 +1768,8 @@ cache_purgevfs(struct mount *mp)
|
||||
|
||||
/* Scan hash tables for applicable entries */
|
||||
SDT_PROBE1(vfs, namecache, purgevfs, done, mp);
|
||||
if (mp->mnt_nvnodelistsize <= ncpurgeminvnodes)
|
||||
return;
|
||||
TAILQ_INIT(&ncps);
|
||||
n_nchash = nchash + 1;
|
||||
vlp1 = vlp2 = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user