From: Matthew Dillon Date: Sat, 8 Dec 2012 05:21:55 +0000 (-0800) Subject: kernel - Adjust NFS server for new allocvnode() code X-Git-Tag: v3.2.2~8 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/9106bf2234026fe6086d343402bec0fb5a896be5 kernel - Adjust NFS server for new allocvnode() code * Adjust the NFS server to check for LWP_MP_VNLRU garbage collection requests and act on them. This prevents excessive allocation of vnodes by the nfsd's. --- diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 3dea3c09a8..7346f16854 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -872,6 +872,25 @@ lwpuserret(struct lwp *lp) } } +/* + * Kernel threads run from user processes can also accumulate deferred + * actions which need to be acted upon. Callers include: + * + * nfsd - Can allocate lots of vnodes + */ +void +lwpkthreaddeferred(void) +{ + struct lwp *lp = curthread->td_lwp; + + if (lp) { + if (lp->lwp_mpflags & LWP_MP_VNLRU) { + atomic_clear_int(&lp->lwp_mpflags, LWP_MP_VNLRU); + allocvnode_gc(); + } + } +} + /* * Scan all processes on the allproc list. The process is automatically * held for the callback. A return value of -1 terminates the loop. diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ed18513678..971e44ba3d 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -570,6 +570,7 @@ int pholdzomb (struct proc *); void prelezomb (struct proc *); void pstall (struct proc *, const char *, int); void lwpuserret(struct lwp *); +void lwpkthreaddeferred(void); u_int32_t procrunnable (void); diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index c3d5c8a364..dce5f8cf06 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -661,6 +661,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) error = (*(nfsrv3_procs[nd->nd_procnum]))(nd, slp, nfsd->nfsd_td, &mreq); /* NOT YET lwkt_gettoken(&slp->ns_token); */ + lwpkthreaddeferred(); /* vnlru issues */ } if (mreq == NULL) break;