Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2003 18:05:38 -0800
From:      Wes Peters <wes@softweyr.com>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Patch to protect process from pageout killing
Message-ID:  <200303241805.38175.wes@softweyr.com>
In-Reply-To: <7019.1048523782@critter.freebsd.dk>
References:  <7019.1048523782@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 24 March 2003 08:36, Poul-Henning Kamp wrote:
> In message <200303240823.48262.wes@softweyr.com>, Wes Peters writes:
> >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.
> >
> >Is this a good approach to the problem?  Feedback welcome.
>
> (Ignoring the white-space change)

OK, I put them back so the function will be inconsistent again. ;^)

They accidentally got shuffled when I move my implementation from just 
below RLIMIT_CPU (from which it obviously and erroneously heavily 
borrowed) to put it in numerical order.

> I can certainly see the point, but I'm not sure this is the way.
>
> I am not sure that we want to use the resource limits facility for
> booleans, some of the logic sourounding the suser checks may not
> hold tight.

I had concerns about that as well.  In the original (4.4 roughly) 
implementation I used madvise as the interface, but the madvise 
interface has changed greatly.  It didn't seem worthwhile adding a 
syscall for this task, so I looked for another reasonable protected 
interface to ab(use).  I'm 100% open to suggestions on the API.

> Also, doesn't this result in the flag being inerited with fork() and
> thereby negating the effect you are seeking for squid ?

I looked through all the places in kern_fork.c where p2->p_flag gets set 
and didn't see anything that looked like it would inherit P_PROTECTED 
from p1->p_flag.  Did I miss something?  I'm obviously a bit of a 
neophyte in this part of the kernel.

-- 
         "Where am I, and what am I doing in this handbasket?"

Wes Peters                                              wes@softweyr.com



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?200303241805.38175.wes>