From 95b1a21908ac832bcdd37b2a441da4a621e91c2b Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 10 Jul 2026 00:16:57 -0400 Subject: [PATCH] jemalloc: skip extent test with profiling enabled This fixes rust-jemalloc-sys build on darwin. Linux builds pass only when overcommit is enabled in kernel, so it's better to disable it for both platforms. See: https://github.com/jemalloc/jemalloc/pull/2954 Assisted-by: Codex gpt-5.5 xhigh --- pkgs/by-name/je/jemalloc/package.nix | 8 +++++++ .../skip-extent-test-with-prof-active.patch | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/by-name/je/jemalloc/skip-extent-test-with-prof-active.patch diff --git a/pkgs/by-name/je/jemalloc/package.nix b/pkgs/by-name/je/jemalloc/package.nix index 15d3b903b5f5..3529c01c83cf 100644 --- a/pkgs/by-name/je/jemalloc/package.nix +++ b/pkgs/by-name/je/jemalloc/package.nix @@ -51,6 +51,14 @@ stdenv.mkDerivation (finalAttrs: { # `rtree_read.constprop.0` shows up in some builds but # not others, so we fall back to O2: ./o3-to-o2.patch + + # Active profiling may make xallocx decline to grow non-page-aligned + # allocations, so test/integration/extent can observe decommit without + # the matching commit on platforms with real decommit/commit. + # + # A (longer) patch addressing the failure posted upstream at: + # https://github.com/jemalloc/jemalloc/pull/2954 + ./skip-extent-test-with-prof-active.patch ]; nativeBuildInputs = [ diff --git a/pkgs/by-name/je/jemalloc/skip-extent-test-with-prof-active.patch b/pkgs/by-name/je/jemalloc/skip-extent-test-with-prof-active.patch new file mode 100644 index 000000000000..1440435c1458 --- /dev/null +++ b/pkgs/by-name/je/jemalloc/skip-extent-test-with-prof-active.patch @@ -0,0 +1,24 @@ +diff --git a/test/integration/extent.sh b/test/integration/extent.sh +index 39fb0a73..ee9f3ed4 100644 +--- a/test/integration/extent.sh ++++ b/test/integration/extent.sh +@@ -1,5 +1,19 @@ + #!/bin/sh + ++# With active profiling, xallocx may decline to grow non-page-aligned ++# allocations. On platforms with real decommit/commit, this can make this ++# test observe a successful decommit without the matching commit. ++case ",${MALLOC_CONF_ALL}," in ++ *,prof:true,*) ++ case ",${MALLOC_CONF_ALL}," in ++ *,prof_active:false,*) ++ ;; ++ *) ++ return 1 ++ ;; ++ esac ++esac ++ + if [ "x${enable_fill}" = "x1" ] ; then + export MALLOC_CONF="junk:false" + fi