This commit is contained in:
xigaoxinyan 2021-12-29 20:59:19 +08:00
parent 30326867d2
commit df7ec938d1
6 changed files with 81 additions and 4 deletions

View File

@ -0,0 +1,19 @@
diff -Nur jemalloc-5.2.1/src/arena.c tmp/src/arena.c
--- jemalloc-5.2.1/src/arena.c 2019-08-06 04:02:00.000000000 +0800
+++ tmp/src/arena.c 2021-11-03 10:23:41.243648055 +0800
@@ -199,13 +199,12 @@
malloc_mutex_lock(tsdn, &arena->tcache_ql_mtx);
cache_bin_array_descriptor_t *descriptor;
ql_foreach(descriptor, &arena->cache_bin_array_descriptor_ql, link) {
- szind_t i = 0;
- for (; i < SC_NBINS; i++) {
+ for (szind_t i = 0; i < SC_NBINS; i++) {
cache_bin_t *tbin = &descriptor->bins_small[i];
arena_stats_accum_zu(&astats->tcache_bytes,
tbin->ncached * sz_index2size(i));
}
- for (; i < nhbins; i++) {
+ for (szind_t i = 0; i < nhbins - SC_NBINS; i++) {
cache_bin_t *tbin = &descriptor->bins_large[i];
arena_stats_accum_zu(&astats->tcache_bytes,
tbin->ncached * sz_index2size(i));

View File

@ -0,0 +1,26 @@
diff -Nur jemalloc-5.2.1/include/jemalloc/internal/hash.h tmp/include/jemalloc/internal/hash.h
--- jemalloc-5.2.1/include/jemalloc/internal/hash.h 2019-08-06 04:02:00.000000000 +0800
+++ tmp/include/jemalloc/internal/hash.h 2021-11-16 10:49:41.199628212 +0800
@@ -182,19 +182,19 @@
case 13: k4 ^= tail[12] << 0;
k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
JEMALLOC_FALLTHROUGH
- case 12: k3 ^= tail[11] << 24; JEMALLOC_FALLTHROUGH
+ case 12: k3 ^= (uint32_t) tail[11] << 24; JEMALLOC_FALLTHROUGH
case 11: k3 ^= tail[10] << 16; JEMALLOC_FALLTHROUGH
case 10: k3 ^= tail[ 9] << 8; JEMALLOC_FALLTHROUGH
case 9: k3 ^= tail[ 8] << 0;
k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
JEMALLOC_FALLTHROUGH
- case 8: k2 ^= tail[ 7] << 24; JEMALLOC_FALLTHROUGH
+ case 8: k2 ^= (uint32_t) tail[ 7] << 24; JEMALLOC_FALLTHROUGH
case 7: k2 ^= tail[ 6] << 16; JEMALLOC_FALLTHROUGH
case 6: k2 ^= tail[ 5] << 8; JEMALLOC_FALLTHROUGH
case 5: k2 ^= tail[ 4] << 0;
k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
JEMALLOC_FALLTHROUGH
- case 4: k1 ^= tail[ 3] << 24; JEMALLOC_FALLTHROUGH
+ case 4: k1 ^= (uint32_t) tail[ 3] << 24; JEMALLOC_FALLTHROUGH
case 3: k1 ^= tail[ 2] << 16; JEMALLOC_FALLTHROUGH
case 2: k1 ^= tail[ 1] << 8; JEMALLOC_FALLTHROUGH
case 1: k1 ^= tail[ 0] << 0;

View File

@ -0,0 +1,28 @@
diff -Nur jemalloc-5.2.1/src/tcache.c tmp/src/tcache.c
--- jemalloc-5.2.1/src/tcache.c 2019-08-06 04:02:00.000000000 +0800
+++ tmp/src/tcache.c 2021-11-16 19:12:46.889312051 +0800
@@ -778,21 +778,15 @@
void
tcache_prefork(tsdn_t *tsdn) {
- if (!config_prof && opt_tcache) {
- malloc_mutex_prefork(tsdn, &tcaches_mtx);
- }
+ malloc_mutex_prefork(tsdn, &tcaches_mtx);
}
void
tcache_postfork_parent(tsdn_t *tsdn) {
- if (!config_prof && opt_tcache) {
- malloc_mutex_postfork_parent(tsdn, &tcaches_mtx);
- }
+ malloc_mutex_postfork_parent(tsdn, &tcaches_mtx);
}
void
tcache_postfork_child(tsdn_t *tsdn) {
- if (!config_prof && opt_tcache) {
- malloc_mutex_postfork_child(tsdn, &tcaches_mtx);
- }
+ malloc_mutex_postfork_child(tsdn, &tcaches_mtx);
}

Binary file not shown.

BIN
jemalloc-5.2.1.tar.bz2 Normal file

Binary file not shown.

View File

@ -11,13 +11,16 @@
%endif
Name: jemalloc
Version: 5.1.0
Release: 4
Version: 5.2.1
Release: 1
Summary: General-purpose scalable concurrent malloc implementation
License: BSD
URL: http://www.canonware.com/jemalloc/
Source0: https://github.com/jemalloc/%{name}/releases/download/%{version}/%{name}-%{version}.tar.bz2
Patch1: backport-Jemalloc-5.2.1-patch-1-fix-large-bin-index-accessed-through-cache-bin-descriptor.patch
Patch2: backport-Jemalloc-5.2.1-patch-2-fix-undefined-behavior-in-hash.patch
Patch3: backport-Jemalloc-5.2.1-patch-3-fix-tcaches-mutex-pre-post-fork-handling.patch
BuildRequires: libxslt perl-generators gcc
%description
@ -47,10 +50,8 @@ uname -a
%make_build
%check
%if %{?_with_check:1}%{!?_with_check:0}
LD_LIBRARY_PATH=%{buildroot}%{_libdir} make test %{?_smp_mflags}
make check
%endif
%install
%make_install
@ -81,6 +82,9 @@ make check
%{_mandir}/man3/jemalloc.3*
%changelog
* Thu Dec 30 2021 xigaoxinyan <xigaoxinyan@huawei.com> - 5.2.1-1
- Update jemlloc
* Wed Jun 02 2021 wulei <wulei80@huawei.com> - 5.1.0-4
- fixes failed: no acceptable C compiler found in $PATH