rts: Ensure we always give MADV_DONTNEED a chance in osDecommitMemory
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 1 Dec 2016 17:55:23 +0000 (12:55 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 1 Dec 2016 17:56:25 +0000 (12:56 -0500)
commit6576bf83cdf4eac05eb88a24aa934a736c91e3da
treeccbe11eb38c070e0d78af4153ba2fc93220f26ce
parent7214e924ca690946288ccf681ef652cee3cb114c
rts: Ensure we always give MADV_DONTNEED a chance in osDecommitMemory

As described in #12865, newer Linux kernels support both MADV_FREE and
MADV_DONTNEED. Previously a runtime would fail to try MADV_DONTNEED if
MADV_FREE failed (e.g. since the kernel which the image is running on
doesn't support the latter). Now we try MADV_DONTNEED if MADV_FREE
failed to ensure that binaries compiled on a kernel supporting MADV_FREE
don't fail on decommit.

Test Plan: Validate

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2780

GHC Trac Issues: #12865
rts/posix/OSMem.c