diff options
author | jeff <jeff@FreeBSD.org> | 2002-08-13 05:29:48 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-08-13 05:29:48 +0000 |
commit | d18378e088f5d3ff05499097373f285b9b675338 (patch) | |
tree | d9dd79315e5bdace7ca79a3a92d5b6c028bfdbf5 /sys/kern/vfs_subr.c | |
parent | efe80496468c598981d1e815625ec541d27d9f3c (diff) | |
download | FreeBSD-src-d18378e088f5d3ff05499097373f285b9b675338.zip FreeBSD-src-d18378e088f5d3ff05499097373f285b9b675338.tar.gz |
- Extend the vnode_free_list_mtx to cover numvnodes and freevnodes. This
was done only some of the time before, and now it is uniformly applied.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 095716f..696c294 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -144,7 +144,12 @@ int nfs_mount_type = -1; /* To keep more than one thread at a time from running vfs_getnewfsid */ static struct mtx mntid_mtx; -/* For any iteration/modification of vnode_free_list */ +/* + * Lock for any access to the following: + * vnode_free_list + * numvnodes + * freevnodes + */ static struct mtx vnode_free_list_mtx; /* @@ -616,11 +621,14 @@ vnlru_proc(void) s = splbio(); for (;;) { kthread_suspend_check(p); + mtx_lock(&vnode_free_list_mtx); if (numvnodes - freevnodes <= desiredvnodes * 9 / 10) { + mtx_unlock(&vnode_free_list_mtx); vnlruproc_sig = 0; tsleep(vnlruproc, PVFS, "vlruwt", 0); continue; } + mtx_unlock(&vnode_free_list_mtx); done = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { @@ -741,6 +749,8 @@ getnewvnode(tag, mp, vops, vpp) struct mount *vnmp; s = splbio(); + mtx_lock(&vnode_free_list_mtx); + /* * Try to reuse vnodes if we hit the max. This situation only * occurs in certain large-memory (2G+) situations. We cannot @@ -758,8 +768,6 @@ getnewvnode(tag, mp, vops, vpp) * good minimum for good LRU performance. */ - mtx_lock(&vnode_free_list_mtx); - if (freevnodes >= wantfreevnodes && numvnodes >= minvnodes) { int error; int count; @@ -870,6 +878,7 @@ getnewvnode(tag, mp, vops, vpp) splx(s); #if 0 + mp_fixme("This code does not lock access to numvnodes && freevnodes."); vnodeallocs++; if (vnodeallocs % vnoderecycleperiod == 0 && freevnodes < vnoderecycleminfreevn && @@ -2761,6 +2770,9 @@ sysctl_vnode(SYSCTL_HANDLER_ARGS) struct vnode *vp; int error, len, n; + /* + * Stale numvnodes access is not fatal here. + */ req->lock = 0; len = (numvnodes + KINFO_VNODESLOP) * sizeof *xvn; if (!req->oldptr) |