From owner-freebsd-stable@FreeBSD.ORG Tue Apr 12 14:26:41 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE42F16A4CE for ; Tue, 12 Apr 2005 14:26:41 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6921543D46 for ; Tue, 12 Apr 2005 14:26:41 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 9EB011F0A1; Tue, 12 Apr 2005 16:26:40 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 86F4F62F7; Tue, 12 Apr 2005 16:26:40 +0200 (CEST) Date: Tue, 12 Apr 2005 16:26:40 +0200 From: Marc Olzheim To: Nick Barnes Message-ID: <20050412142640.GB1570@stack.nl> References: <0c9a92c2eb7461f25aa924322407f950@khera.org> <51434.1113314801@thrush.ravenbrook.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <51434.1113314801@thrush.ravenbrook.com> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Vivek Khera cc: freebsd-stable@freebsd.org Subject: Re: kernel killing processes when out of swap X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2005 14:26:41 -0000 --cmJC7u66zC7hs+87 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 12, 2005 at 03:06:41PM +0100, Nick Barnes wrote: > The right choice is for mmap() to return ENOMEM, and then for malloc() > to return NULL, but almost no operating systems make this choice any > more. No, the problem occurs only when previously allocated / mmap()d blocks are actually used (written) and when the total of virtual memory has been overcommitted: Physical pages are not allocated to processes at malloc() time, but at time of first usage (Copy On Write). A possible solution would be for the kernel to only hand out memory allocation-time when it's possible to back it up with virtual memory, but normal memory usage allows for overcommits just fine and many programs have been programmed in a way that assumes this behaviour, for instance by sparsely using large allocations instead of adding the possible extra bookkeeping to allow for smaller allocations. It just makes a lot of memory allocation / duplication issues a lot easier... Marc --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCW9qgezjnobFOgrERAgVCAKCL3eaLjKIg717mq1T8QSAesdO/HQCgv0FX w8OmE5m5ED2LowplQTOjmg8= =TJz3 -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87--