From 8895fc4b4b7f62963a0f52b05c76767cbc4fba74 Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: May 02 2020 18:58:21 +0000 Subject: Issue 50992 - Bump jemalloc version and enable profiling Description: jemalloc 5.2.1 release introduced a number of fixes. https://github.com/jemalloc/jemalloc/releases/tag/5.2.1 Additionally: * Override default page and hugepage sizes, because builder machines may not match the target systems. * Enable profiling by default (--enable-perf), so it can be used for troubleshooting. Fixes: https://pagure.io/389-ds-base/issue/50992 Reviewed by: mreynolds (Thanks!) --- diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index b9f8548..5f8c3dc 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -4,7 +4,7 @@ %global bundle_jemalloc __BUNDLE_JEMALLOC__ %if %{bundle_jemalloc} %global jemalloc_name jemalloc -%global jemalloc_ver 5.2.0 +%global jemalloc_ver 5.2.1 %endif # This is used in certain builds to help us know if it has extra features. @@ -367,12 +367,30 @@ LEGACY_FLAGS="--disable-legacy --disable-perl" %endif %if %{bundle_jemalloc} +# Override page size, bz #1545539 +# 4K +%ifarch %ix86 %arm x86_64 s390x +%define lg_page --with-lg-page=12 +%endif + +# 64K +%ifarch ppc64 ppc64le aarch64 +%define lg_page --with-lg-page=16 +%endif + +# Override huge page size on aarch64 +# 2M instead of 512M +%ifarch aarch64 +%define lg_hugepage --with-lg-hugepage=21 +%endif + # Build jemalloc pushd ../%{jemalloc_name}-%{jemalloc_ver} %configure \ --libdir=%{_libdir}/%{pkgname}/lib \ - --bindir=%{_libdir}/%{pkgname}/bin -make + --bindir=%{_libdir}/%{pkgname}/bin \ + --enable-prof %{lg_page} %{lg_hugepage} +make %{?_smp_mflags} popd %endif diff --git a/wrappers/systemd.template.service.custom.conf.in b/wrappers/systemd.template.service.custom.conf.in index fd10fe1..1c92410 100644 --- a/wrappers/systemd.template.service.custom.conf.in +++ b/wrappers/systemd.template.service.custom.conf.in @@ -51,3 +51,7 @@ TimeoutStopSec=600 # Preload jemalloc Environment=LD_PRELOAD=@libdir@/@package_name@/lib/libjemalloc.so.2 + +# Uncomment to enable leak checking using jemalloc's heap profiler +# https://github.com/jemalloc/jemalloc/wiki/Use-Case%3A-Leak-Checking +#Environment=MALLOC_CONF=prof_leak:true,lg_prof_sample:0,prof_final:true,prof_prefix:/var/run/dirsrv/jeprof