[DHG_packages] 01/01: ghc: add osdecommitmemory-compat.patch

Sean Whitton spw-guest at moszumanska.debian.org
Sat Dec 10 18:52:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

spw-guest pushed a commit to branch master
in repository DHG_packages.

commit f234d5f6a89d7f1773d08ea3c98258bd0e04a9bf
Author: Sean Whitton <spwhitton at spwhitton.name>
Date:   Sat Dec 10 10:01:33 2016 -0700

    ghc: add osdecommitmemory-compat.patch
---
 p/ghc/debian/changelog                             |  6 ++++
 p/ghc/debian/patches/osdecommitmemory-compat.patch | 37 ++++++++++++++++++++++
 p/ghc/debian/patches/series                        |  1 +
 3 files changed, 44 insertions(+)

diff --git a/p/ghc/debian/changelog b/p/ghc/debian/changelog
index 346f76c..4f054a0 100644
--- a/p/ghc/debian/changelog
+++ b/p/ghc/debian/changelog
@@ -1,3 +1,9 @@
+ghc (8.0.1-15) UNRELEASED; urgency=high
+
+  * Add osdecommitmemory-compat.patch (Closes: #847677).
+
+ -- Sean Whitton <spwhitton at spwhitton.name>  Sat, 10 Dec 2016 09:57:34 -0700
+
 ghc (8.0.1-14) unstable; urgency=medium
 
   * Upload to unstable.
diff --git a/p/ghc/debian/patches/osdecommitmemory-compat.patch b/p/ghc/debian/patches/osdecommitmemory-compat.patch
new file mode 100644
index 0000000..001c01d
--- /dev/null
+++ b/p/ghc/debian/patches/osdecommitmemory-compat.patch
@@ -0,0 +1,37 @@
+Description: rts: Ensure we always give MADV_DONTNEED a chance in osDecommitMemory
+Author: Ben Gamari <bgamari.foss at gmail.com>
+Origin: upstream, https://phabricator.haskell.org/D2780
+Bug: https://ghc.haskell.org/trac/ghc/ticket/12865
+Bug-Debian: https://bugs.debian.org/847677
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rts/posix/OSMem.c
++++ b/rts/posix/OSMem.c
+@@ -506,11 +506,24 @@ void osDecommitMemory(void *at, W_ size)
+ 
+ #ifdef MADV_FREE
+     // Try MADV_FREE first, FreeBSD has both and MADV_DONTNEED
+-    // just swaps memory out
++    // just swaps memory out. Linux >= 4.5 has both DONTNEED and FREE; either
++    // will work as they both allow the system to free anonymous pages.
++    // It is important that we try both methods as the kernel which we were
++    // built on may differ from the kernel we are now running on.
+     r = madvise(at, size, MADV_FREE);
+-#else
+-    r = madvise(at, size, MADV_DONTNEED);
++    if(r < 0) {
++        if (errno == EINVAL) {
++            // Perhaps the system doesn't support MADV_FREE; fall-through and
++            // try MADV_DONTNEED.
++        } else {
++            sysErrorBelch("unable to decommit memory");
++        }
++    } else {
++        return;
++    }
+ #endif
++
++    r = madvise(at, size, MADV_DONTNEED);
+     if(r < 0)
+         sysErrorBelch("unable to decommit memory");
+ }
diff --git a/p/ghc/debian/patches/series b/p/ghc/debian/patches/series
index f0fac5b..2ffbb76 100644
--- a/p/ghc/debian/patches/series
+++ b/p/ghc/debian/patches/series
@@ -12,3 +12,4 @@ compiler-cmm-PprC-sparc-alignment.patch
 get-linker-flags-correctly
 x32-use-native-x86_64-insn.patch
 fix-ppc-lwa-generation
+osdecommitmemory-compat.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git



More information about the Pkg-haskell-commits mailing list