Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2003 17:23:03 -0800
From:      David Schultz <das@FreeBSD.ORG>
To:        Wes Peters <wes@softweyr.com>
Cc:        freebsd-arch@FreeBSD.ORG
Subject:   Re: Patch to protect process from pageout killing
Message-ID:  <20030325012303.GA4406@HAL9000.homeunix.com>
In-Reply-To: <200303240823.48262.wes@softweyr.com>
References:  <200303240823.48262.wes@softweyr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Wes Peters <wes@softweyr.com>:
> As promised, here's the patch to protect a process from being killed when 
> pageout is in memory shortage.  This allows a process to specify that it 
> is important enough to be skipped when pageout is looking for the largest 
> process to kill.
> 
> My needs are simple.  We make a box that is a web proxy and runs from a 
> memory disk, using flash for permanent storage.  The flash is mounted 
> only when a configuration write is needed, the box runs from the memory 
> disk.  We've experienced a problem at certain customer sites where bind 
> will consume a lot (~30 MB) of ram and then pageout will kill the largest 
> process, which is usually either named or squid.  This pretty much kills 
> the box.  We'd much rather have pageout kill off some of the squid worker 
> processes, we can recover from that.

Very nice.  Inheritance of this attribute seems to be a
contentious issue.  Making inheritance tunable might be a good
idea.  You wouldn't be able to piggyback on rlimit, though.

There's a significant userland component of this as well, although
that's probably a job for another day.  It basically consists of
making it possible to specify that certain standard system daemons
should have this attribute.

> +			    (p->p_flag & P_PROTECTED) ||
>  			    ((p->p_pid < 48) && (vm_swap_size != 0))) {
>  				PROC_UNLOCK(p);
>  				continue;

The pid < 48 magic can probably go away, while you're at it.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030325012303.GA4406>