From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 12 14:09:07 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B9AE16A4CE for ; Tue, 12 Apr 2005 14:09:07 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F9E243D45 for ; Tue, 12 Apr 2005 14:09:07 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.3/8.13.1) with ESMTP id j3CE8ktD017547; Tue, 12 Apr 2005 10:08:46 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.MIT.EDU (8.13.3/8.13.1/Submit) id j3CE8kfl017546; Tue, 12 Apr 2005 10:08:46 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 12 Apr 2005 10:08:46 -0400 From: David Schultz To: ALeine , killing@multiplay.co.uk, freebsd-hackers@FreeBSD.ORG Message-ID: <20050412140846.GA17282@VARK.MIT.EDU> Mail-Followup-To: ALeine , killing@multiplay.co.uk, freebsd-hackers@freebsd.org References: <200504121224.j3CCOFXL019177@marlena.vvi.at> <20050412132219.GB784@empiric.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050412132219.GB784@empiric.icir.org> Subject: Re: kernel killing processes when out of swap X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2005 14:09:07 -0000 On Tue, Apr 12, 2005, Bruce M Simpson wrote: > On Tue, Apr 12, 2005 at 05:24:15AM -0700, ALeine wrote: > > machine. Having a flag to tag processes as vital to prevent them from getting > > killed (or to give them lower next-to-be-killed priority so that all non-vital > > processes get killed first) when you run out of swap would be a useful feature, > > P_SYSTEM provides something like this feature, amongst others. It is used by > init(8). However P_SYSTEM also says that process statistics should not be > maintained, and that the signals that may be dispatched to such processes > are restricted. A madvise(NULL, 0, MADV_PROTECT) is the best way to tell the kernel not to kill your process. You must be running as root to use it. Now that disk space is cheap, it would be even nicer if we had a non-overcommit mode for swap, as most System V-derived systems do. Then at least processes would get ENOMEM instead of SIGKILL in a space shortage. I don't think this would be too hard to add, except possibly for handling OBJT_DEFAULT objects.