From owner-cvs-src Fri Mar 14 23:54:39 2003 Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BF2037B404; Fri, 14 Mar 2003 23:54:34 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A65F43F93; Fri, 14 Mar 2003 23:54:33 -0800 (PST) (envelope-from das@FreeBSD.org) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h2F7sSIX025528; Fri, 14 Mar 2003 23:54:28 -0800 (PST) (envelope-from das@FreeBSD.org) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h2F7sSpC025527; Fri, 14 Mar 2003 23:54:28 -0800 (PST) (envelope-from das@FreeBSD.org) Date: Fri, 14 Mar 2003 23:54:27 -0800 From: David Schultz To: Juli Mallett Cc: Eivind Eklund , Mike Silbersack , 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> Mail-Followup-To: Juli Mallett , Eivind Eklund , Mike Silbersack , arch@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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030314101857.A98861@FreeBSD.org> Sender: owner-cvs-src@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Followups set to arch@] Thus spake Juli Mallett : > 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