Date: Mon, 3 Oct 2016 00:02:32 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306608 - head/sys/kern Message-ID: <201610030002.u9302WNn025174@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon Oct 3 00:02:32 2016 New Revision: 306608 URL: https://svnweb.freebsd.org/changeset/base/306608 Log: 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 Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Oct 2 23:59:31 2016 (r306607) +++ head/sys/kern/vfs_cache.c Mon Oct 3 00:02:32 2016 (r306608) @@ -207,6 +207,9 @@ SYSCTL_ULONG(_debug, OID_AUTO, numcacheh 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610030002.u9302WNn025174>