Patch to protect process from pageout killing

Wes Peters wes at softweyr.com
Fri Mar 28 09:11:09 PST 2003


On Tuesday 25 March 2003 00:25, Poul-Henning Kamp wrote:
>
> As I see it, there is a need for several mechanisms:
>
> 1. A mechanism to export to userland enough information about the
>    current RAM availability, so that phkmalloc and application
>    specific code can make intelligent choices before things go bad.
>
> 2. A mechanism to alert userland to the fact that things _have_ gone
>    bad.
>
> 3. A mechanism to influence the "Who do we kill ?" decision once
>    things have gone from bad to worse.
>
> To tackle them from behind:
>
> Wes has a proposal for #3 which is a per-process flag which says
> "I'm sacred".  I think that is a sound principle since that is
> usually exactly what people want:  Do Not Kill This Process.
>
> Certain processes already enjoy special protection, pid==1 most
> notably, this would just be a way to make the same protection
> available to other processes.  I'm not happy about using the
> resourcelimit code for booleans, and I don't think the flag
> should be inherited, but otherwise I'm for the idea.

I've reworked my patch to use the madvise(2) syscall, like the original 
4.x patch did.  I've even documented it, in a man page of all places.  
Please see attached patch.  If nobody objects, I'll commit sometime this 
weekend.

> We have the SIGDANGER proposal for #2, but I think we need to have
> two severities:  "Out of RAM" and "Out of VM".  A program like
> fsck would start to recycle cached sectors once we're out of RAM.

I'll work with Garance to create a proposal, some pseudocode, something 
like a design.  Then we can bikeshed that.  Mike Murphy is helping 
silently at work, letting me bounce ideas off him and look at the man 
pages on his AIX machine.

> But I have not seen anybody come up with a good proposal for
> #1, and that is where the main benefit would be derived:  It would
> allow processes to be good citizens and adjust to the present
> situation.

Added to think-about queue...

-- 

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

Wes Peters                                               wes at softweyr.com


More information about the freebsd-arch mailing list