From 275fa4162c68ea51938bb9e92e073015bbe19fe9 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Wed, 13 Dec 2017 12:02:46 -0500 Subject: [PATCH] jemalloc: disable transparent huge pages by default on ARMv6/7 The default NixOS kernels for ARMv7 (and probably ARMv6) do not have support for transparent huge pages, but jemalloc is unable to detect this. This is a known bug and the current solution is to pass --disable-thp to ./configure. --- pkgs/development/libraries/jemalloc/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index 8c8c181409d4..ebe9ce46f9ab 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, + # jemalloc is unable to correctly detect transparent hugepage support on + # ARM (https://github.com/jemalloc/jemalloc/issues/526), and the default + # kernel ARMv6/7 kernel does not enable it, so we explicitly disable support + thpSupport ? !stdenv.isArm }: stdenv.mkDerivation rec { name = "jemalloc-${version}"; @@ -12,7 +16,8 @@ stdenv.mkDerivation rec { # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which # then stops downstream builds (mariadb in particular) from detecting it. This # option should remove the prefix and give us a working jemalloc. - configureFlags = stdenv.lib.optional stdenv.isDarwin "--with-jemalloc-prefix="; + configureFlags = stdenv.lib.optional stdenv.isDarwin "--with-jemalloc-prefix=" + ++ stdenv.lib.optional (!thpSupport) "--disable-thp"; doCheck = true;