rts: Inform kernel that we won't need reserved address space
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 26 Sep 2017 14:09:06 +0000 (10:09 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 26 Sep 2017 15:59:53 +0000 (11:59 -0400)
commit1d1b991ee15e0428be16d1bfad7087051e000bdc
treea93d8d4852e611666953a09beb5745e4f302710b
parent62464071455ea0472903ef1d94833e5eefb8f74e
rts: Inform kernel that we won't need reserved address space

Trac #14192 points out that currently GHC's two-step allocator results
in extremely large coredumps. It seems like WebKit may have encountered
similar issues and their apparent solution uses madvise(MADV_DONTNEED)
while reserving address space to inform the kernel that the address
space we just requested needs no backing. Perhaps this is used by the
core dump logic to trim out uncommitted pages.

Test Plan: Validate, try core-dumping a compiled executable

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #14192, #14193

Differential Revision: https://phabricator.haskell.org/D3929
rts/posix/OSMem.c