Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 23:54:27 -0800
From:      David Schultz <das@FreeBSD.org>
To:        Juli Mallett <jmallett@FreeBSD.org>
Cc:        Eivind Eklund <eivind@FreeBSD.org>, Mike Silbersack <silby@silby.com>, arch@FreeBSD.org
Subject:   Re: cvs commit: src/sys/vm vm_map.c vm_map.h vm_pageout.c
Message-ID:  <20030315075427.GA25332@HAL9000.homeunix.com>
In-Reply-To: <20030314101857.A98861@FreeBSD.org>
References:  <200303122313.h2CNDHMU046431@repoman.freebsd.org> <20030312175458.J32334@odysseus.silby.com> <20030313005115.GA11794@HAL9000.homeunix.com> <20030313154226.X682@odysseus.silby.com> <20030314012954.A42430@FreeBSD.org> <20030314101857.A98861@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[Followups set to arch@]

Thus spake Juli Mallett <jmallett@FreeBSD.org>:
> I've had that happen for me (though the combinations required are a lot
> lower, as my RAM is a lot lower :>), and that's why I started looking into
> this.  I didn't realise my name had been dragged into this until just now :)
> 
> Basically I was adding a new signal, SIGVM (or SIGNOMEM), and the semantics
> were as such:
> 	1) If a process has SIG_IGN for the signal set, it is skipped over
> 	   when looking for a process to kill.
> 	2) If a process has SIG_DFL for the signal set, it is "killable,"
> 	   in that it is willing to die.
> 	3) If a process has a handler for the signal set, that handler is
> 	   invoked*.

The rest of this thread seems to have gone off in half a dozen
unrelated directions, so I'm replying to your original post.

I think the fundamental principle here is that when the kernel is
dangerously low on virtual memory, it needs to be able to choose a
process to kill and be guaranteed that the process will die right
away and without generating many page faults.  It would also be
great if the administrator could mark a few processes as
off-limits in a way that the pagedaemon can understand.  Remember
that this is a rather rare situation; the system doesn't have to
do something incredibly intelligent, it just has to do something
reasonable.

Beyond that, getting the kernel to send out ``I might kill you
soon, so exit'' warnings ahead of time would be cool if userland
programs were taught about them.  But the kernel has to do that
while there's still enough memory to entertain the idea of
cooperation.  phk's idea is also interesting but unrelated; IIRC,
the keyword to search the archives for is SIGVM.

> * - Note that I've waffled about that quite a bit.  I think that we'd want
> libc to maybe default to letting phkmalloc try to shrink the break area,
> or get rid of some spare buffers.  All the obvious things like that.

The 'H' option to malloc() notifies the kernel of heap space that
can be marked clean and reused via madvise().  It is disabled by
default, but you could imagine that malloc() might take a signal
from the kernel and start making madvise() calls automatically.
But as phk mentioned, this is something you do when you have
insufficient physical memory, not when you're out of swap, so it's
a separate topic.

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




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