Date: Wed, 10 Mar 1999 23:50:01 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/10528: MFS fails to die when system shut down Message-ID: <199903110750.XAA38489@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/10528; it has been noted by GNATS.
From: Matthew Dillon <dillon@apollo.backplane.com>
To: Cy Schubert - ITSD Open Systems Group <Cy.Schubert@uumail.gov.bc.ca>
Cc: freebsd-gnats-submit@FreeBSD.ORG, cschuber@uumail.gov.bc.ca
Subject: Re: kern/10528: MFS fails to die when system shut down
Date: Wed, 10 Mar 1999 23:40:50 -0800 (PST)
:Matthew, I've been trying to solve a "syncing filesystems... giving up"
:problem under 3.1. My first cut was effective under some
:circumstances, e.g. copying files to MFS but if MFS was used for /tmp
:and X was in use at the time of the shutdown, my patch would still
:fail. I've devised a better patch as follows. What do you think?
:
:What I've done is change the P_SYSTEM flag to a P_NOSWAP. What I don't
:understand is the comment about the swapper continuously trying to kill
:MFS. I can see why you don't want it to swap out, because of potential
:...
The problem is that if the system runs out of swap space and memory,
it will attempt to kill the 'largest' process. This from
vm/vm_pageout.c:
...
/*
* make sure that we have swap space -- if we are low on memory and
* swap -- then kill the biggest process.
*/
if ((vm_swap_size == 0 || swap_pager_full) &&
((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min)) {
bigproc = NULL;
bigsize = 0;
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
/*
* if this is a system process, skip it
*/
if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) ||
((p->p_pid < 48) && (vm_swap_size != 0))) {
continue;
}
...
Current setting P_NOSWAP will not prevent the system from trying to
kill the process. Perhaps, though, it would be safe to add P_NOSWAP
in and not have the system try to swap out a P_NOSWAP process either,
which with your patch would solve both problems.
P_NOSWAP appears to only be set normally when the system is in the
midst of a fork. I think it would be safe to modify pageout.c from
if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || ...
to
if ((p->p_flag & (P_NOSWAP|P_SYSTEM)) || (p->p_pid == 1) || ...
*PLUS* your patch. I will submit your patch, plus my modification
above, to core.
-Matt
Matthew Dillon
<dillon@backplane.com>
:deadlock. It solves a "syncing filesystems" problem during shutdown.
:I tested during a shutdown while a file is currently being written
:to /tmp. Previously the system would panic: vinvalbuf: dirty bufs.
:With the patch below it doesn't do that any more. Does my patch
:introduce another problem?
:
:I'd appreciate some guidance.
:
:--- src/sys/ufs/mfs/mfs_vfsops.c.orig Thu Dec 31 20:14:11 1998
:+++ src/sys/ufs/mfs/mfs_vfsops.c Wed Mar 10 21:08:13 1999
:@@ -399,7 +399,8 @@
: * can we swap out this process - not unless you want a deadlock,
: * anyway.
: */
:- curproc->p_flag |= P_SYSTEM;
:+ /* curproc->p_flag |= P_SYSTEM; */
:+ curproc->p_flag |= P_NOSWAP;
:
: while (mfsp->mfs_active) {
: while (bp = bufq_first(&mfsp->buf_queue)) {
:
:Regards, Phone: (250)387-8437
:Cy Schubert Fax: (250)387-5766
:Open Systems Group Internet: Cy.Schubert@uumail.gov.bc.ca
:ITSD Cy.Schubert@gems8.gov.bc.ca
:Province of BC
:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903110750.XAA38489>
