From 275fa4162c68ea51938bb9e92e073015bbe19fe9 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Wed, 13 Dec 2017 12:02:46 -0500 Subject: [PATCH 1/3] 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; From 98dd418e8576838a5f7dccaaa7ff0567c76d09f2 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Wed, 13 Dec 2017 12:45:07 -0500 Subject: [PATCH 2/3] jemalloc: 4.5.0 -> 5.0.1 --- pkgs/development/libraries/jemalloc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index ebe9ce46f9ab..ee8703a4cf38 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -6,11 +6,11 @@ stdenv.mkDerivation rec { name = "jemalloc-${version}"; - version = "4.5.0"; + version = "5.0.1"; src = fetchurl { url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2"; - sha256 = "9409d85664b4f135b77518b0b118c549009dc10f6cba14557d170476611f6780"; + sha256 = "4814781d395b0ef093b21a08e8e6e0bd3dab8762f9935bbfb71679b0dea7c3e9"; }; # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which From 02e95ea0b5dc4d62fd1d8cc48e881840b4b07b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 2 Jan 2018 15:23:17 +0100 Subject: [PATCH 3/3] jemalloc: do not expose hugepage support as an option The only common use case so far seems ARMv6/ARMv7 support. The way this option is exposed might collide with a package with the same name. Also the option naming on its own is not self-descriptive without context. --- pkgs/development/libraries/jemalloc/default.nix | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix index ee8703a4cf38..d11ec0a78236 100644 --- a/pkgs/development/libraries/jemalloc/default.nix +++ b/pkgs/development/libraries/jemalloc/default.nix @@ -1,8 +1,4 @@ -{ 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, fetchurl }: stdenv.mkDerivation rec { name = "jemalloc-${version}"; @@ -17,11 +13,12 @@ stdenv.mkDerivation rec { # 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=" - ++ stdenv.lib.optional (!thpSupport) "--disable-thp"; - + # 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 + ++ stdenv.lib.optional stdenv.isArm "--disable-thp"; doCheck = true; - meta = with stdenv.lib; { homepage = http://jemalloc.net; description = "General purpose malloc(3) implementation";