From owner-cvs-all Fri Mar 14 12: 1: 7 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7789737B404; Fri, 14 Mar 2003 12:01:04 -0800 (PST) Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2456943F93; Fri, 14 Mar 2003 12:01:03 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp3.server.rpi.edu (8.12.8/8.12.7) with ESMTP id h2EK10QA024852; Fri, 14 Mar 2003 15:01:01 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <3E720B5B.8090200@tcoip.com.br> 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> <3E720B5B.8090200@tcoip.com.br> Date: Fri, 14 Mar 2003 15:00:59 -0500 To: "Daniel C. Sobral" From: Garance A Drosihn Subject: Re: cvs commit: src/sys/vm ... SIGDANGER Cc: Juli Mallett , Eivind Eklund , Mike Silbersack , David Schultz , src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.28 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 2:03 PM -0300 3/14/03, Daniel C. Sobral wrote: >Garance A Drosihn wrote: >> >>AIX (and maybe some other systems?) have a signal called SIGDANGER, >>which is meant for this kind of situation. If we implement some >>new signal, then perhaps it would be good to use that signal name >>and mimic their implementation of it. > >Yes, SIGDANGER has the same default action as SIGTERM. If the >application installs a handler, fine. Otherwise, it dies. Not quite right. From the description at: http://nscp.upenn.edu/aix4.3html/aixbman/baseadmn/pag_space_under.htm When the number of free paging-space blocks falls below a threshold known as the paging-space warning level, the system informs all processes (except kprocs) of this condition by sending the SIGDANGER signal. If the shortage continues and falls below a second threshold known as the paging-space kill level, the system sends the SIGKILL signal to processes that are the major users of paging space and that do not have a signal handler for the SIGDANGER signal (the default action for the SIGDANGER signal is to ignore the signal). The system continues sending SIGKILL signals until the number of free paging-space blocks is above the paging-space kill level. Processes that dynamically allocate memory can ensure that sufficient paging space exists by monitoring the paging-space levels with the psdanger subroutine or by using special allocation routines. You can use the disclaim subroutine to prevent processes from ending when the paging-space kill level is reached. To do this, define a signal handler for the SIGDANGER signal and release memory and paging-space resources allocated in their data and stack areas and in shared memory segments. (there is a bit more written at the web page). A process can install a SIGACTION signal handler because it *does* want to free up memory when the system hits the first threshold level, or because it does *not* want to get killed when the system reaches the second threshold level. It seems to me that this would provide processes with most of the control that they need, and it provides the correct "default behavior" for processes which do not install the signal handler. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message