Subject: Re: No swap?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 04/09/2002 12:32:17
On Mon, Apr 08, 2002 at 04:45:26PM -0400, der Mouse wrote:
> Actually, it also does 1 to some extent.
> 
> > This means that when the event occurs that clams the page, it may not
> > exist.  When this happens, the operation that requested the page has
> > long since finished with a successful return, so the application
> > thinks it already owns the page.  So the kernel cannot simply fail
> > the operation by returning a failure code.  And since nothing else is
> > freeing up memory, the choices are limited.
> 
> The kernel _can_ fail the operation.  In a sense, that's what happens:
> "Killed: out of swap" is a rather drastic failure mode.  I'd prefer to
> convert that to a new signal, rather than SIGKILL, one which kills by
> default.  Then processes that care can mlock the relevant code, handle
> that signal on a (locked) signal stack, and do something appropriate.
> 
> In particular, it would help my test programs immensely: I have
> programs that want to allocate memory until they run out, and then do
> something (typically, free up some command-line-specified amount of
> it).  Getting a SIGKILL upon running out of memory makes that somewhat
> harder.
> 

Upon detection 'out of swap' condition I would send signal to some designated
process (init comes to mind) which could be taught what to do, which process
is important, etc.

Regards,
	Andrey