Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Apr 2005 16:26:40 +0200
From:      Marc Olzheim <marcolz@stack.nl>
To:        Nick Barnes <Nick.Barnes@pobox.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: kernel killing processes when out of swap
Message-ID:  <20050412142640.GB1570@stack.nl>
In-Reply-To: <51434.1113314801@thrush.ravenbrook.com>
References:  <0c9a92c2eb7461f25aa924322407f950@khera.org> <51434.1113314801@thrush.ravenbrook.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



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