From 12f2610cb5fd215c51d36de2cbe51871b7b98f5d Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 19 Dec 2001 01:31:12 +0000 Subject: [PATCH] Use a different mechanism to get the vnlru process to wake up and notice the shutdown request at reboot/halt time. Disable the printf 'vnlru process getting nowhere, pausing...' and instead export the count to the debug.vnlru_nowhere sysctl. --- sys/kern/kern_kthread.c | 1 + sys/kern/vfs_subr.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index b5ed8d4e70ec..09fcbad45808 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -149,6 +149,7 @@ kthread_suspend(struct proc *p, int timo) return (EINVAL); } SIGADDSET(p->p_siglist, SIGSTOP); + wakeup(p); return msleep(&p->p_siglist, &p->p_mtx, PPAUSE | PDROP, "suspkt", timo); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ae297f0b1723..840cac8bd9cf 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -247,6 +247,9 @@ SYSCTL_INT(_kern, KERN_MAXVNODES, maxvnodes, CTLFLAG_RW, static int minvnodes; SYSCTL_INT(_kern, OID_AUTO, minvnodes, CTLFLAG_RW, &minvnodes, 0, "Minimum number of vnodes"); +static int vnlru_nowhere = 0; +SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW, &vnlru_nowhere, 0, + "Number of times the vnlru process ran without success"); /* * Initialize the vnode management data structures. @@ -594,7 +597,7 @@ vnlru_proc(void) kthread_suspend_check(p); if (numvnodes - freevnodes <= desiredvnodes * 9 / 10) { vnlruproc_sig = 0; - tsleep(&vnlruproc, PVFS, "vlruwt", hz); + tsleep(vnlruproc, PVFS, "vlruwt", 0); continue; } done = 0; @@ -611,8 +614,15 @@ vnlru_proc(void) } mtx_unlock(&mountlist_mtx); if (done == 0) { - printf("vnlru process getting nowhere, pausing..\n"); - tsleep(&vnlru_proc, PPAUSE, "vlrup", hz * 3); +#if 0 + /* These messages are temporary debugging aids */ + if (vnlru_nowhere < 5) + printf("vnlru process getting nowhere..\n"); + else if (vnlru_nowhere == 5) + printf("vnlru process messages stopped.\n"); +#endif + vnlru_nowhere++; + tsleep(vnlru_proc, PPAUSE, "vlrup", hz * 3); } } splx(s); @@ -655,7 +665,7 @@ getnewvnode(tag, mp, vops, vpp) */ if (vnlruproc_sig == 0 && numvnodes - freevnodes > desiredvnodes) { vnlruproc_sig = 1; /* avoid unnecessary wakeups */ - wakeup(&vnlruproc); + wakeup(vnlruproc); } /*