Fixes for upstream bug #392. Package will now build on el5/ppc,

el5/i386 and el6/i386
This commit is contained in:
Ingvar Hagelund 2016-11-01 23:09:15 +01:00
parent ccade2a2ac
commit 9c7bf44d0b
4 changed files with 350 additions and 1 deletions

View File

@ -0,0 +1,108 @@
From 2c53faf352ca7722f1a776c8c381b01da5b4fa96 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 10:44:39 -0700
Subject: [PATCH] Periodically purge in memory-intensive integration tests.
This resolves #393.
---
test/integration/aligned_alloc.c | 13 ++++++++++---
test/integration/mallocx.c | 7 +++++++
test/integration/posix_memalign.c | 13 ++++++++++---
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
index 6090014..80bb38f 100644
--- a/test/integration/aligned_alloc.c
+++ b/test/integration/aligned_alloc.c
@@ -1,9 +1,7 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
+#define MAXALIGN (((size_t)1) << 25)
TEST_BEGIN(test_alignment_errors)
{
@@ -74,6 +72,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
+#define NITER 4
size_t alignment, size, total;
unsigned i;
void *ps[NITER];
@@ -110,7 +109,15 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
+#undef NITER
}
TEST_END
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 55e1a09..69ce781 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -196,6 +196,13 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
#undef MAXALIGN
#undef NITER
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
index 19741c6..171bcea 100644
--- a/test/integration/posix_memalign.c
+++ b/test/integration/posix_memalign.c
@@ -1,9 +1,7 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
+#define MAXALIGN (((size_t)1) << 25)
TEST_BEGIN(test_alignment_errors)
{
@@ -66,6 +64,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
+#define NITER 4
size_t alignment, size, total;
unsigned i;
int err;
@@ -104,7 +103,15 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
+#undef NITER
}
TEST_END

View File

@ -0,0 +1,28 @@
From eaecaad8ea9fd9cd8b57e49834b5e3332f911c40 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 11:00:36 -0700
Subject: [PATCH] Periodically purge in memory-intensive integration tests.
This resolves #393.
---
test/integration/mallocx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 69ce781..79ab494 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -139,6 +139,13 @@ TEST_BEGIN(test_basic)
rsz = sallocx(p, 0);
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
dallocx(p, 0);
+ /*
+ * On systems which can't merge extents, this test generates a
+ * lot of dirty memory very quickly. Purge between cycles to
+ * avoid potential OOM on e.g. 32-bit Windows.
+ */
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
}
#undef MAXSZ
}

View File

@ -0,0 +1,201 @@
From b99c72f3d29e3590ae81959922d0032a29dbace9 Mon Sep 17 00:00:00 2001
From: Jason Evans <jasone@canonware.com>
Date: Fri, 28 Oct 2016 11:23:24 -0700
Subject: [PATCH] Reduce memory requirements for regression tests.
This is intended to drop memory usage to a level that AppVeyor test
instances can handle.
This resolves #393.
---
test/integration/aligned_alloc.c | 23 +++++++++++++-------
test/integration/mallocx.c | 44 ++++++++++++++++++++++-----------------
test/integration/posix_memalign.c | 23 +++++++++++++-------
3 files changed, 55 insertions(+), 35 deletions(-)
diff --git a/test/integration/aligned_alloc.c b/test/integration/aligned_alloc.c
index 80bb38f..5843842 100644
--- a/test/integration/aligned_alloc.c
+++ b/test/integration/aligned_alloc.c
@@ -1,7 +1,20 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
+
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
TEST_BEGIN(test_alignment_errors)
{
@@ -109,13 +122,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef NITER
}
diff --git a/test/integration/mallocx.c b/test/integration/mallocx.c
index 79ab494..43b76eb 100644
--- a/test/integration/mallocx.c
+++ b/test/integration/mallocx.c
@@ -50,6 +50,19 @@ get_huge_size(size_t ind)
return (get_size_impl("arenas.hchunk.0.size", ind));
}
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
+
TEST_BEGIN(test_overflow)
{
size_t hugemax;
@@ -96,6 +109,7 @@ TEST_BEGIN(test_oom)
if (ptrs[i] != NULL)
dallocx(ptrs[i], 0);
}
+ purge();
#if LG_SIZEOF_PTR == 3
assert_ptr_null(mallocx(0x8000000000000000ULL,
@@ -113,7 +127,7 @@ TEST_END
TEST_BEGIN(test_basic)
{
-#define MAXSZ (((size_t)1) << 26)
+#define MAXSZ (((size_t)1) << 23)
size_t sz;
for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
@@ -122,30 +136,28 @@ TEST_BEGIN(test_basic)
nsz = nallocx(sz, 0);
assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
p = mallocx(sz, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=0) error", sz);
rsz = sallocx(p, 0);
assert_zu_ge(rsz, sz, "Real size smaller than expected");
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch");
dallocx(p, 0);
p = mallocx(sz, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=0) error", sz);
dallocx(p, 0);
nsz = nallocx(sz, MALLOCX_ZERO);
assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
p = mallocx(sz, MALLOCX_ZERO);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
+ assert_ptr_not_null(p,
+ "Unexpected mallocx(size=%zx, flags=MALLOCX_ZERO) error",
+ nsz);
rsz = sallocx(p, 0);
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
dallocx(p, 0);
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef MAXSZ
}
@@ -153,7 +165,7 @@ TEST_END
TEST_BEGIN(test_alignment_and_size)
{
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
#define NITER 4
size_t nsz, rsz, sz, alignment, total;
unsigned i;
@@ -203,13 +215,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef MAXALIGN
#undef NITER
diff --git a/test/integration/posix_memalign.c b/test/integration/posix_memalign.c
index 171bcea..e22e102 100644
--- a/test/integration/posix_memalign.c
+++ b/test/integration/posix_memalign.c
@@ -1,7 +1,20 @@
#include "test/jemalloc_test.h"
#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 25)
+#define MAXALIGN (((size_t)1) << 23)
+
+/*
+ * On systems which can't merge extents, tests that call this function generate
+ * a lot of dirty memory very quickly. Purging between cycles mitigates
+ * potential OOM on e.g. 32-bit Windows.
+ */
+static void
+purge(void)
+{
+
+ assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
+ "Unexpected mallctl error");
+}
TEST_BEGIN(test_alignment_errors)
{
@@ -103,13 +116,7 @@ TEST_BEGIN(test_alignment_and_size)
}
}
}
- /*
- * On systems which can't merge extents, this test generates a
- * lot of dirty memory very quickly. Purge between cycles to
- * avoid potential OOM on e.g. 32-bit Windows.
- */
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
+ purge();
}
#undef NITER
}

View File

@ -1,7 +1,7 @@
Name: jemalloc
Version: 4.2.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: General-purpose scalable concurrent malloc implementation
Group: System Environment/Libraries
@ -16,6 +16,11 @@ Patch2: jemalloc-armv5-force-atomic.patch
Patch3: jemalloc-3.0.0.atomic_h_ppc_32bit_operations.patch
Patch4: jemalloc-3.6.0.no_explicit_altivec.patch
# Upstream bug #393, fixes for memory usage in integration tests
Patch10: jemalloc-4.2.1.upstream_bug393_1.patch
Patch11: jemalloc-4.2.1.upstream_bug393_2.patch
Patch12: jemalloc-4.2.1.upstream_bug393_3.patch
BuildRequires: /usr/bin/xsltproc
BuildRequires: perl-generators
%ifnarch s390 %{mips}
@ -45,6 +50,9 @@ developing applications that use %{name}.
%patch4 -b .ppc
%endif
%endif
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
%ifarch i686
@ -104,6 +112,10 @@ rm -rf %{buildroot}
%postun -p /sbin/ldconfig
%changelog
* Tue Nov 01 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> - 4.2.1-2
- Fixes for upstream bug #392. Package will now build on el5/ppc,
el5/i386 and el6/i386
* Tue Aug 23 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> - 4.2.1-1
- New upstream release