about summary refs log tree commit diff
path: root/src/rt/jemalloc/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-18 15:26:24 -0700
committerbors <bors@rust-lang.org>2013-10-18 15:26:24 -0700
commitdf187a0b67cf94b339220c3fa7b9d2edbe4d05aa (patch)
tree46e01e5cc346070285c64a8bd68827cc5363f6dd /src/rt/jemalloc/test
parent6b07d885f3dd1a80ffca113925a949386371ea97 (diff)
parent90911d72592fedbce0c34d8a0e20b5aac5c781bf (diff)
downloadrust-df187a0b67cf94b339220c3fa7b9d2edbe4d05aa.tar.gz
rust-df187a0b67cf94b339220c3fa7b9d2edbe4d05aa.zip
auto merge of #9933 : alexcrichton/rust/no-jemalloc, r=brson
As discovered in #9925, it turns out that we weren't using jemalloc on most
platforms. Additionally, on some platforms we were using it incorrectly and
mismatching the libc version of malloc with the jemalloc version of malloc.

Additionally, it's not clear that using jemalloc is indeed a large performance
win in particular situtations. This could be due to building jemalloc
incorrectly, or possibly due to using jemalloc incorrectly, but it is unclear at
this time.

Until jemalloc can be confirmed to integrate correctly on all platforms and has
verifiable large performance wins on platforms as well, it shouldn't be part of
the default build process. It should still be available for use via the
LD_PRELOAD trick on various architectures, but using it as the default allocator
for everything would require guaranteeing that it works in all situtations,
which it currently doesn't.

Closes #9925
Diffstat (limited to 'src/rt/jemalloc/test')
-rw-r--r--src/rt/jemalloc/test/ALLOCM_ARENA.c67
-rw-r--r--src/rt/jemalloc/test/ALLOCM_ARENA.exp2
-rw-r--r--src/rt/jemalloc/test/aligned_alloc.c119
-rw-r--r--src/rt/jemalloc/test/aligned_alloc.exp25
-rw-r--r--src/rt/jemalloc/test/allocated.c118
-rw-r--r--src/rt/jemalloc/test/allocated.exp2
-rw-r--r--src/rt/jemalloc/test/allocm.c194
-rw-r--r--src/rt/jemalloc/test/allocm.exp25
-rw-r--r--src/rt/jemalloc/test/bitmap.c153
-rw-r--r--src/rt/jemalloc/test/bitmap.exp2
-rw-r--r--src/rt/jemalloc/test/jemalloc_test.h.in53
-rw-r--r--src/rt/jemalloc/test/mremap.c60
-rw-r--r--src/rt/jemalloc/test/mremap.exp2
-rw-r--r--src/rt/jemalloc/test/posix_memalign.c115
-rw-r--r--src/rt/jemalloc/test/posix_memalign.exp25
-rw-r--r--src/rt/jemalloc/test/rallocm.c127
-rw-r--r--src/rt/jemalloc/test/rallocm.exp2
-rw-r--r--src/rt/jemalloc/test/thread_arena.c81
-rw-r--r--src/rt/jemalloc/test/thread_arena.exp2
-rw-r--r--src/rt/jemalloc/test/thread_tcache_enabled.c91
-rw-r--r--src/rt/jemalloc/test/thread_tcache_enabled.exp2
21 files changed, 0 insertions, 1267 deletions
diff --git a/src/rt/jemalloc/test/ALLOCM_ARENA.c b/src/rt/jemalloc/test/ALLOCM_ARENA.c
deleted file mode 100644
index 2c52485e890..00000000000
--- a/src/rt/jemalloc/test/ALLOCM_ARENA.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#define	NTHREADS 10
-
-void *
-je_thread_start(void *arg)
-{
-	unsigned thread_ind = (unsigned)(uintptr_t)arg;
-	unsigned arena_ind;
-	int r;
-	void *p;
-	size_t rsz, sz;
-
-	sz = sizeof(arena_ind);
-	if (mallctl("arenas.extend", &arena_ind, &sz, NULL, 0)
-	    != 0) {
-		malloc_printf("Error in arenas.extend\n");
-		abort();
-	}
-
-	if (thread_ind % 4 != 3) {
-		size_t mib[3];
-		size_t miblen = sizeof(mib) / sizeof(size_t);
-		const char *dss_precs[] = {"disabled", "primary", "secondary"};
-		const char *dss = dss_precs[thread_ind % 4];
-		if (mallctlnametomib("arena.0.dss", mib, &miblen) != 0) {
-			malloc_printf("Error in mallctlnametomib()\n");
-			abort();
-		}
-		mib[1] = arena_ind;
-		if (mallctlbymib(mib, miblen, NULL, NULL, (void *)&dss,
-		    sizeof(const char *))) {
-			malloc_printf("Error in mallctlbymib()\n");
-			abort();
-		}
-	}
-
-	r = allocm(&p, &rsz, 1, ALLOCM_ARENA(arena_ind));
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected allocm() error\n");
-		abort();
-	}
-	dallocm(p, 0);
-
-	return (NULL);
-}
-
-int
-main(void)
-{
-	je_thread_t threads[NTHREADS];
-	unsigned i;
-
-	malloc_printf("Test begin\n");
-
-	for (i = 0; i < NTHREADS; i++) {
-		je_thread_create(&threads[i], je_thread_start,
-		    (void *)(uintptr_t)i);
-	}
-
-	for (i = 0; i < NTHREADS; i++)
-		je_thread_join(threads[i], NULL);
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/ALLOCM_ARENA.exp b/src/rt/jemalloc/test/ALLOCM_ARENA.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/ALLOCM_ARENA.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/aligned_alloc.c b/src/rt/jemalloc/test/aligned_alloc.c
deleted file mode 100644
index 5a9b0caea78..00000000000
--- a/src/rt/jemalloc/test/aligned_alloc.c
+++ /dev/null
@@ -1,119 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
-
-int
-main(void)
-{
-	size_t alignment, size, total;
-	unsigned i;
-	void *p, *ps[NITER];
-
-	malloc_printf("Test begin\n");
-
-	/* Test error conditions. */
-	alignment = 0;
-	set_errno(0);
-	p = aligned_alloc(alignment, 1);
-	if (p != NULL || get_errno() != EINVAL) {
-		malloc_printf(
-		    "Expected error for invalid alignment %zu\n", alignment);
-	}
-
-	for (alignment = sizeof(size_t); alignment < MAXALIGN;
-	    alignment <<= 1) {
-		set_errno(0);
-		p = aligned_alloc(alignment + 1, 1);
-		if (p != NULL || get_errno() != EINVAL) {
-			malloc_printf(
-			    "Expected error for invalid alignment %zu\n",
-			    alignment + 1);
-		}
-	}
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x8000000000000000);
-	size      = UINT64_C(0x8000000000000000);
-#else
-	alignment = 0x80000000LU;
-	size      = 0x80000000LU;
-#endif
-	set_errno(0);
-	p = aligned_alloc(alignment, size);
-	if (p != NULL || get_errno() != ENOMEM) {
-		malloc_printf(
-		    "Expected error for aligned_alloc(%zu, %zu)\n",
-		    alignment, size);
-	}
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x4000000000000000);
-	size      = UINT64_C(0x8400000000000001);
-#else
-	alignment = 0x40000000LU;
-	size      = 0x84000001LU;
-#endif
-	set_errno(0);
-	p = aligned_alloc(alignment, size);
-	if (p != NULL || get_errno() != ENOMEM) {
-		malloc_printf(
-		    "Expected error for aligned_alloc(%zu, %zu)\n",
-		    alignment, size);
-	}
-
-	alignment = 0x10LU;
-#if LG_SIZEOF_PTR == 3
-	size = UINT64_C(0xfffffffffffffff0);
-#else
-	size = 0xfffffff0LU;
-#endif
-	set_errno(0);
-	p = aligned_alloc(alignment, size);
-	if (p != NULL || get_errno() != ENOMEM) {
-		malloc_printf(
-		    "Expected error for aligned_alloc(&p, %zu, %zu)\n",
-		    alignment, size);
-	}
-
-	for (i = 0; i < NITER; i++)
-		ps[i] = NULL;
-
-	for (alignment = 8;
-	    alignment <= MAXALIGN;
-	    alignment <<= 1) {
-		total = 0;
-		malloc_printf("Alignment: %zu\n", alignment);
-		for (size = 1;
-		    size < 3 * alignment && size < (1U << 31);
-		    size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
-			for (i = 0; i < NITER; i++) {
-				ps[i] = aligned_alloc(alignment, size);
-				if (ps[i] == NULL) {
-					char buf[BUFERROR_BUF];
-
-					buferror(buf, sizeof(buf));
-					malloc_printf(
-					    "Error for size %zu (%#zx): %s\n",
-					    size, size, buf);
-					exit(1);
-				}
-				total += malloc_usable_size(ps[i]);
-				if (total >= (MAXALIGN << 1))
-					break;
-			}
-			for (i = 0; i < NITER; i++) {
-				if (ps[i] != NULL) {
-					free(ps[i]);
-					ps[i] = NULL;
-				}
-			}
-		}
-	}
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/aligned_alloc.exp b/src/rt/jemalloc/test/aligned_alloc.exp
deleted file mode 100644
index b5061c7277e..00000000000
--- a/src/rt/jemalloc/test/aligned_alloc.exp
+++ /dev/null
@@ -1,25 +0,0 @@
-Test begin
-Alignment: 8
-Alignment: 16
-Alignment: 32
-Alignment: 64
-Alignment: 128
-Alignment: 256
-Alignment: 512
-Alignment: 1024
-Alignment: 2048
-Alignment: 4096
-Alignment: 8192
-Alignment: 16384
-Alignment: 32768
-Alignment: 65536
-Alignment: 131072
-Alignment: 262144
-Alignment: 524288
-Alignment: 1048576
-Alignment: 2097152
-Alignment: 4194304
-Alignment: 8388608
-Alignment: 16777216
-Alignment: 33554432
-Test end
diff --git a/src/rt/jemalloc/test/allocated.c b/src/rt/jemalloc/test/allocated.c
deleted file mode 100644
index 9884905d810..00000000000
--- a/src/rt/jemalloc/test/allocated.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-void *
-je_thread_start(void *arg)
-{
-	int err;
-	void *p;
-	uint64_t a0, a1, d0, d1;
-	uint64_t *ap0, *ap1, *dp0, *dp1;
-	size_t sz, usize;
-
-	sz = sizeof(a0);
-	if ((err = mallctl("thread.allocated", &a0, &sz, NULL, 0))) {
-		if (err == ENOENT) {
-#ifdef JEMALLOC_STATS
-			assert(false);
-#endif
-			goto label_return;
-		}
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		exit(1);
-	}
-	sz = sizeof(ap0);
-	if ((err = mallctl("thread.allocatedp", &ap0, &sz, NULL, 0))) {
-		if (err == ENOENT) {
-#ifdef JEMALLOC_STATS
-			assert(false);
-#endif
-			goto label_return;
-		}
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		exit(1);
-	}
-	assert(*ap0 == a0);
-
-	sz = sizeof(d0);
-	if ((err = mallctl("thread.deallocated", &d0, &sz, NULL, 0))) {
-		if (err == ENOENT) {
-#ifdef JEMALLOC_STATS
-			assert(false);
-#endif
-			goto label_return;
-		}
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		exit(1);
-	}
-	sz = sizeof(dp0);
-	if ((err = mallctl("thread.deallocatedp", &dp0, &sz, NULL, 0))) {
-		if (err == ENOENT) {
-#ifdef JEMALLOC_STATS
-			assert(false);
-#endif
-			goto label_return;
-		}
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		exit(1);
-	}
-	assert(*dp0 == d0);
-
-	p = malloc(1);
-	if (p == NULL) {
-		malloc_printf("%s(): Error in malloc()\n", __func__);
-		exit(1);
-	}
-
-	sz = sizeof(a1);
-	mallctl("thread.allocated", &a1, &sz, NULL, 0);
-	sz = sizeof(ap1);
-	mallctl("thread.allocatedp", &ap1, &sz, NULL, 0);
-	assert(*ap1 == a1);
-	assert(ap0 == ap1);
-
-	usize = malloc_usable_size(p);
-	assert(a0 + usize <= a1);
-
-	free(p);
-
-	sz = sizeof(d1);
-	mallctl("thread.deallocated", &d1, &sz, NULL, 0);
-	sz = sizeof(dp1);
-	mallctl("thread.deallocatedp", &dp1, &sz, NULL, 0);
-	assert(*dp1 == d1);
-	assert(dp0 == dp1);
-
-	assert(d0 + usize <= d1);
-
-label_return:
-	return (NULL);
-}
-
-int
-main(void)
-{
-	int ret = 0;
-	je_thread_t thread;
-
-	malloc_printf("Test begin\n");
-
-	je_thread_start(NULL);
-
-	je_thread_create(&thread, je_thread_start, NULL);
-	je_thread_join(thread, (void *)&ret);
-
-	je_thread_start(NULL);
-
-	je_thread_create(&thread, je_thread_start, NULL);
-	je_thread_join(thread, (void *)&ret);
-
-	je_thread_start(NULL);
-
-	malloc_printf("Test end\n");
-	return (ret);
-}
diff --git a/src/rt/jemalloc/test/allocated.exp b/src/rt/jemalloc/test/allocated.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/allocated.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/allocm.c b/src/rt/jemalloc/test/allocm.c
deleted file mode 100644
index 80be673b8fd..00000000000
--- a/src/rt/jemalloc/test/allocm.c
+++ /dev/null
@@ -1,194 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
-
-int
-main(void)
-{
-	int r;
-	void *p;
-	size_t nsz, rsz, sz, alignment, total;
-	unsigned i;
-	void *ps[NITER];
-
-	malloc_printf("Test begin\n");
-
-	sz = 42;
-	nsz = 0;
-	r = nallocm(&nsz, sz, 0);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected nallocm() error\n");
-		abort();
-	}
-	rsz = 0;
-	r = allocm(&p, &rsz, sz, 0);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected allocm() error\n");
-		abort();
-	}
-	if (rsz < sz)
-		malloc_printf("Real size smaller than expected\n");
-	if (nsz != rsz)
-		malloc_printf("nallocm()/allocm() rsize mismatch\n");
-	if (dallocm(p, 0) != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected dallocm() error\n");
-
-	r = allocm(&p, NULL, sz, 0);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected allocm() error\n");
-		abort();
-	}
-	if (dallocm(p, 0) != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected dallocm() error\n");
-
-	nsz = 0;
-	r = nallocm(&nsz, sz, ALLOCM_ZERO);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected nallocm() error\n");
-		abort();
-	}
-	rsz = 0;
-	r = allocm(&p, &rsz, sz, ALLOCM_ZERO);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected allocm() error\n");
-		abort();
-	}
-	if (nsz != rsz)
-		malloc_printf("nallocm()/allocm() rsize mismatch\n");
-	if (dallocm(p, 0) != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected dallocm() error\n");
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x8000000000000000);
-	sz        = UINT64_C(0x8000000000000000);
-#else
-	alignment = 0x80000000LU;
-	sz        = 0x80000000LU;
-#endif
-	nsz = 0;
-	r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment));
-	if (r == ALLOCM_SUCCESS) {
-		malloc_printf(
-		    "Expected error for nallocm(&nsz, %zu, %#x)\n",
-		    sz, ALLOCM_ALIGN(alignment));
-	}
-	rsz = 0;
-	r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment));
-	if (r == ALLOCM_SUCCESS) {
-		malloc_printf(
-		    "Expected error for allocm(&p, %zu, %#x)\n",
-		    sz, ALLOCM_ALIGN(alignment));
-	}
-	if (nsz != rsz)
-		malloc_printf("nallocm()/allocm() rsize mismatch\n");
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x4000000000000000);
-	sz        = UINT64_C(0x8400000000000001);
-#else
-	alignment = 0x40000000LU;
-	sz        = 0x84000001LU;
-#endif
-	nsz = 0;
-	r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment));
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected nallocm() error\n");
-	rsz = 0;
-	r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment));
-	if (r == ALLOCM_SUCCESS) {
-		malloc_printf(
-		    "Expected error for allocm(&p, %zu, %#x)\n",
-		    sz, ALLOCM_ALIGN(alignment));
-	}
-
-	alignment = 0x10LU;
-#if LG_SIZEOF_PTR == 3
-	sz = UINT64_C(0xfffffffffffffff0);
-#else
-	sz = 0xfffffff0LU;
-#endif
-	nsz = 0;
-	r = nallocm(&nsz, sz, ALLOCM_ALIGN(alignment));
-	if (r == ALLOCM_SUCCESS) {
-		malloc_printf(
-		    "Expected error for nallocm(&nsz, %zu, %#x)\n",
-		    sz, ALLOCM_ALIGN(alignment));
-	}
-	rsz = 0;
-	r = allocm(&p, &rsz, sz, ALLOCM_ALIGN(alignment));
-	if (r == ALLOCM_SUCCESS) {
-		malloc_printf(
-		    "Expected error for allocm(&p, %zu, %#x)\n",
-		    sz, ALLOCM_ALIGN(alignment));
-	}
-	if (nsz != rsz)
-		malloc_printf("nallocm()/allocm() rsize mismatch\n");
-
-	for (i = 0; i < NITER; i++)
-		ps[i] = NULL;
-
-	for (alignment = 8;
-	    alignment <= MAXALIGN;
-	    alignment <<= 1) {
-		total = 0;
-		malloc_printf("Alignment: %zu\n", alignment);
-		for (sz = 1;
-		    sz < 3 * alignment && sz < (1U << 31);
-		    sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
-			for (i = 0; i < NITER; i++) {
-				nsz = 0;
-				r = nallocm(&nsz, sz,
-				    ALLOCM_ALIGN(alignment) | ALLOCM_ZERO);
-				if (r != ALLOCM_SUCCESS) {
-					malloc_printf(
-					    "nallocm() error for size %zu"
-					    " (%#zx): %d\n",
-					    sz, sz, r);
-					exit(1);
-				}
-				rsz = 0;
-				r = allocm(&ps[i], &rsz, sz,
-				    ALLOCM_ALIGN(alignment) | ALLOCM_ZERO);
-				if (r != ALLOCM_SUCCESS) {
-					malloc_printf(
-					    "allocm() error for size %zu"
-					    " (%#zx): %d\n",
-					    sz, sz, r);
-					exit(1);
-				}
-				if (rsz < sz) {
-					malloc_printf(
-					    "Real size smaller than"
-					    " expected\n");
-				}
-				if (nsz != rsz) {
-					malloc_printf(
-					    "nallocm()/allocm() rsize"
-					    " mismatch\n");
-				}
-				if ((uintptr_t)p & (alignment-1)) {
-					malloc_printf(
-					    "%p inadequately aligned for"
-					    " alignment: %zu\n", p, alignment);
-				}
-				sallocm(ps[i], &rsz, 0);
-				total += rsz;
-				if (total >= (MAXALIGN << 1))
-					break;
-			}
-			for (i = 0; i < NITER; i++) {
-				if (ps[i] != NULL) {
-					dallocm(ps[i], 0);
-					ps[i] = NULL;
-				}
-			}
-		}
-	}
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/allocm.exp b/src/rt/jemalloc/test/allocm.exp
deleted file mode 100644
index b5061c7277e..00000000000
--- a/src/rt/jemalloc/test/allocm.exp
+++ /dev/null
@@ -1,25 +0,0 @@
-Test begin
-Alignment: 8
-Alignment: 16
-Alignment: 32
-Alignment: 64
-Alignment: 128
-Alignment: 256
-Alignment: 512
-Alignment: 1024
-Alignment: 2048
-Alignment: 4096
-Alignment: 8192
-Alignment: 16384
-Alignment: 32768
-Alignment: 65536
-Alignment: 131072
-Alignment: 262144
-Alignment: 524288
-Alignment: 1048576
-Alignment: 2097152
-Alignment: 4194304
-Alignment: 8388608
-Alignment: 16777216
-Alignment: 33554432
-Test end
diff --git a/src/rt/jemalloc/test/bitmap.c b/src/rt/jemalloc/test/bitmap.c
deleted file mode 100644
index b2cb63004bc..00000000000
--- a/src/rt/jemalloc/test/bitmap.c
+++ /dev/null
@@ -1,153 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#if (LG_BITMAP_MAXBITS > 12)
-#  define MAXBITS	4500
-#else
-#  define MAXBITS	(1U << LG_BITMAP_MAXBITS)
-#endif
-
-static void
-test_bitmap_size(void)
-{
-	size_t i, prev_size;
-
-	prev_size = 0;
-	for (i = 1; i <= MAXBITS; i++) {
-		size_t size = bitmap_size(i);
-		assert(size >= prev_size);
-		prev_size = size;
-	}
-}
-
-static void
-test_bitmap_init(void)
-{
-	size_t i;
-
-	for (i = 1; i <= MAXBITS; i++) {
-		bitmap_info_t binfo;
-		bitmap_info_init(&binfo, i);
-		{
-			size_t j;
-			bitmap_t *bitmap = malloc(sizeof(bitmap_t) *
-				bitmap_info_ngroups(&binfo));
-			bitmap_init(bitmap, &binfo);
-
-			for (j = 0; j < i; j++)
-				assert(bitmap_get(bitmap, &binfo, j) == false);
-			free(bitmap);
-
-		}
-	}
-}
-
-static void
-test_bitmap_set(void)
-{
-	size_t i;
-
-	for (i = 1; i <= MAXBITS; i++) {
-		bitmap_info_t binfo;
-		bitmap_info_init(&binfo, i);
-		{
-			size_t j;
-			bitmap_t *bitmap = malloc(sizeof(bitmap_t) *
-				bitmap_info_ngroups(&binfo));
-			bitmap_init(bitmap, &binfo);
-
-			for (j = 0; j < i; j++)
-				bitmap_set(bitmap, &binfo, j);
-			assert(bitmap_full(bitmap, &binfo));
-			free(bitmap);
-		}
-	}
-}
-
-static void
-test_bitmap_unset(void)
-{
-	size_t i;
-
-	for (i = 1; i <= MAXBITS; i++) {
-		bitmap_info_t binfo;
-		bitmap_info_init(&binfo, i);
-		{
-			size_t j;
-			bitmap_t *bitmap = malloc(sizeof(bitmap_t) *
-				bitmap_info_ngroups(&binfo));
-			bitmap_init(bitmap, &binfo);
-
-			for (j = 0; j < i; j++)
-				bitmap_set(bitmap, &binfo, j);
-			assert(bitmap_full(bitmap, &binfo));
-			for (j = 0; j < i; j++)
-				bitmap_unset(bitmap, &binfo, j);
-			for (j = 0; j < i; j++)
-				bitmap_set(bitmap, &binfo, j);
-			assert(bitmap_full(bitmap, &binfo));
-			free(bitmap);
-		}
-	}
-}
-
-static void
-test_bitmap_sfu(void)
-{
-	size_t i;
-
-	for (i = 1; i <= MAXBITS; i++) {
-		bitmap_info_t binfo;
-		bitmap_info_init(&binfo, i);
-		{
-			ssize_t j;
-			bitmap_t *bitmap = malloc(sizeof(bitmap_t) *
-				bitmap_info_ngroups(&binfo));
-			bitmap_init(bitmap, &binfo);
-
-			/* Iteratively set bits starting at the beginning. */
-			for (j = 0; j < i; j++)
-				assert(bitmap_sfu(bitmap, &binfo) == j);
-			assert(bitmap_full(bitmap, &binfo));
-
-			/*
-			 * Iteratively unset bits starting at the end, and
-			 * verify that bitmap_sfu() reaches the unset bits.
-			 */
-			for (j = i - 1; j >= 0; j--) {
-				bitmap_unset(bitmap, &binfo, j);
-				assert(bitmap_sfu(bitmap, &binfo) == j);
-				bitmap_unset(bitmap, &binfo, j);
-			}
-			assert(bitmap_get(bitmap, &binfo, 0) == false);
-
-			/*
-			 * Iteratively set bits starting at the beginning, and
-			 * verify that bitmap_sfu() looks past them.
-			 */
-			for (j = 1; j < i; j++) {
-				bitmap_set(bitmap, &binfo, j - 1);
-				assert(bitmap_sfu(bitmap, &binfo) == j);
-				bitmap_unset(bitmap, &binfo, j);
-			}
-			assert(bitmap_sfu(bitmap, &binfo) == i - 1);
-			assert(bitmap_full(bitmap, &binfo));
-			free(bitmap);
-		}
-	}
-}
-
-int
-main(void)
-{
-	malloc_printf("Test begin\n");
-
-	test_bitmap_size();
-	test_bitmap_init();
-	test_bitmap_set();
-	test_bitmap_unset();
-	test_bitmap_sfu();
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/bitmap.exp b/src/rt/jemalloc/test/bitmap.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/bitmap.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/jemalloc_test.h.in b/src/rt/jemalloc/test/jemalloc_test.h.in
deleted file mode 100644
index e38b48efa41..00000000000
--- a/src/rt/jemalloc/test/jemalloc_test.h.in
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This header should be included by tests, rather than directly including
- * jemalloc/jemalloc.h, because --with-install-suffix may cause the header to
- * have a different name.
- */
-#include "jemalloc/jemalloc@install_suffix@.h"
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/* Abstraction layer for threading in tests */
-#ifdef _WIN32
-#include <windows.h>
-
-typedef HANDLE je_thread_t;
-
-void
-je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg)
-{
-	LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc;
-	*thread = CreateThread(NULL, 0, routine, arg, 0, NULL);
-	if (*thread == NULL) {
-		malloc_printf("Error in CreateThread()\n");
-		exit(1);
-	}
-}
-
-void
-je_thread_join(je_thread_t thread, void **ret)
-{
-	WaitForSingleObject(thread, INFINITE);
-}
-
-#else
-#include <pthread.h>
-
-typedef pthread_t je_thread_t;
-
-void
-je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg)
-{
-
-	if (pthread_create(thread, NULL, proc, arg) != 0) {
-		malloc_printf("Error in pthread_create()\n");
-		exit(1);
-	}
-}
-
-void
-je_thread_join(je_thread_t thread, void **ret)
-{
-
-	pthread_join(thread, ret);
-}
-#endif
diff --git a/src/rt/jemalloc/test/mremap.c b/src/rt/jemalloc/test/mremap.c
deleted file mode 100644
index 47efa7c415b..00000000000
--- a/src/rt/jemalloc/test/mremap.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-int
-main(void)
-{
-	int ret, err;
-	size_t sz, lg_chunk, chunksize, i;
-	char *p, *q;
-
-	malloc_printf("Test begin\n");
-
-	sz = sizeof(lg_chunk);
-	if ((err = mallctl("opt.lg_chunk", &lg_chunk, &sz, NULL, 0))) {
-		assert(err != ENOENT);
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		ret = 1;
-		goto label_return;
-	}
-	chunksize = ((size_t)1U) << lg_chunk;
-
-	p = (char *)malloc(chunksize);
-	if (p == NULL) {
-		malloc_printf("malloc(%zu) --> %p\n", chunksize, p);
-		ret = 1;
-		goto label_return;
-	}
-	memset(p, 'a', chunksize);
-
-	q = (char *)realloc(p, chunksize * 2);
-	if (q == NULL) {
-		malloc_printf("realloc(%p, %zu) --> %p\n", p, chunksize * 2,
-		    q);
-		ret = 1;
-		goto label_return;
-	}
-	for (i = 0; i < chunksize; i++) {
-		assert(q[i] == 'a');
-	}
-
-	p = q;
-
-	q = (char *)realloc(p, chunksize);
-	if (q == NULL) {
-		malloc_printf("realloc(%p, %zu) --> %p\n", p, chunksize, q);
-		ret = 1;
-		goto label_return;
-	}
-	for (i = 0; i < chunksize; i++) {
-		assert(q[i] == 'a');
-	}
-
-	free(q);
-
-	ret = 0;
-label_return:
-	malloc_printf("Test end\n");
-	return (ret);
-}
diff --git a/src/rt/jemalloc/test/mremap.exp b/src/rt/jemalloc/test/mremap.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/mremap.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/posix_memalign.c b/src/rt/jemalloc/test/posix_memalign.c
deleted file mode 100644
index 2185bcf762a..00000000000
--- a/src/rt/jemalloc/test/posix_memalign.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#define CHUNK 0x400000
-/* #define MAXALIGN ((size_t)UINT64_C(0x80000000000)) */
-#define MAXALIGN ((size_t)0x2000000LU)
-#define NITER 4
-
-int
-main(void)
-{
-	size_t alignment, size, total;
-	unsigned i;
-	int err;
-	void *p, *ps[NITER];
-
-	malloc_printf("Test begin\n");
-
-	/* Test error conditions. */
-	for (alignment = 0; alignment < sizeof(void *); alignment++) {
-		err = posix_memalign(&p, alignment, 1);
-		if (err != EINVAL) {
-			malloc_printf(
-			    "Expected error for invalid alignment %zu\n",
-			    alignment);
-		}
-	}
-
-	for (alignment = sizeof(size_t); alignment < MAXALIGN;
-	    alignment <<= 1) {
-		err = posix_memalign(&p, alignment + 1, 1);
-		if (err == 0) {
-			malloc_printf(
-			    "Expected error for invalid alignment %zu\n",
-			    alignment + 1);
-		}
-	}
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x8000000000000000);
-	size      = UINT64_C(0x8000000000000000);
-#else
-	alignment = 0x80000000LU;
-	size      = 0x80000000LU;
-#endif
-	err = posix_memalign(&p, alignment, size);
-	if (err == 0) {
-		malloc_printf(
-		    "Expected error for posix_memalign(&p, %zu, %zu)\n",
-		    alignment, size);
-	}
-
-#if LG_SIZEOF_PTR == 3
-	alignment = UINT64_C(0x4000000000000000);
-	size      = UINT64_C(0x8400000000000001);
-#else
-	alignment = 0x40000000LU;
-	size      = 0x84000001LU;
-#endif
-	err = posix_memalign(&p, alignment, size);
-	if (err == 0) {
-		malloc_printf(
-		    "Expected error for posix_memalign(&p, %zu, %zu)\n",
-		    alignment, size);
-	}
-
-	alignment = 0x10LU;
-#if LG_SIZEOF_PTR == 3
-	size = UINT64_C(0xfffffffffffffff0);
-#else
-	size = 0xfffffff0LU;
-#endif
-	err = posix_memalign(&p, alignment, size);
-	if (err == 0) {
-		malloc_printf(
-		    "Expected error for posix_memalign(&p, %zu, %zu)\n",
-		    alignment, size);
-	}
-
-	for (i = 0; i < NITER; i++)
-		ps[i] = NULL;
-
-	for (alignment = 8;
-	    alignment <= MAXALIGN;
-	    alignment <<= 1) {
-		total = 0;
-		malloc_printf("Alignment: %zu\n", alignment);
-		for (size = 1;
-		    size < 3 * alignment && size < (1U << 31);
-		    size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
-			for (i = 0; i < NITER; i++) {
-				err = posix_memalign(&ps[i],
-				    alignment, size);
-				if (err) {
-					malloc_printf(
-					    "Error for size %zu (%#zx): %s\n",
-					    size, size, strerror(err));
-					exit(1);
-				}
-				total += malloc_usable_size(ps[i]);
-				if (total >= (MAXALIGN << 1))
-					break;
-			}
-			for (i = 0; i < NITER; i++) {
-				if (ps[i] != NULL) {
-					free(ps[i]);
-					ps[i] = NULL;
-				}
-			}
-		}
-	}
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/posix_memalign.exp b/src/rt/jemalloc/test/posix_memalign.exp
deleted file mode 100644
index b5061c7277e..00000000000
--- a/src/rt/jemalloc/test/posix_memalign.exp
+++ /dev/null
@@ -1,25 +0,0 @@
-Test begin
-Alignment: 8
-Alignment: 16
-Alignment: 32
-Alignment: 64
-Alignment: 128
-Alignment: 256
-Alignment: 512
-Alignment: 1024
-Alignment: 2048
-Alignment: 4096
-Alignment: 8192
-Alignment: 16384
-Alignment: 32768
-Alignment: 65536
-Alignment: 131072
-Alignment: 262144
-Alignment: 524288
-Alignment: 1048576
-Alignment: 2097152
-Alignment: 4194304
-Alignment: 8388608
-Alignment: 16777216
-Alignment: 33554432
-Test end
diff --git a/src/rt/jemalloc/test/rallocm.c b/src/rt/jemalloc/test/rallocm.c
deleted file mode 100644
index c5dedf48d7b..00000000000
--- a/src/rt/jemalloc/test/rallocm.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-int
-main(void)
-{
-	size_t pagesize;
-	void *p, *q;
-	size_t sz, tsz;
-	int r;
-
-	malloc_printf("Test begin\n");
-
-	/* Get page size. */
-	{
-#ifdef _WIN32
-		SYSTEM_INFO si;
-		GetSystemInfo(&si);
-		pagesize = (size_t)si.dwPageSize;
-#else
-		long result = sysconf(_SC_PAGESIZE);
-		assert(result != -1);
-		pagesize = (size_t)result;
-#endif
-	}
-
-	r = allocm(&p, &sz, 42, 0);
-	if (r != ALLOCM_SUCCESS) {
-		malloc_printf("Unexpected allocm() error\n");
-		abort();
-	}
-
-	q = p;
-	r = rallocm(&q, &tsz, sz, 0, ALLOCM_NO_MOVE);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q != p)
-		malloc_printf("Unexpected object move\n");
-	if (tsz != sz) {
-		malloc_printf("Unexpected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-
-	q = p;
-	r = rallocm(&q, &tsz, sz, 5, ALLOCM_NO_MOVE);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q != p)
-		malloc_printf("Unexpected object move\n");
-	if (tsz != sz) {
-		malloc_printf("Unexpected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-
-	q = p;
-	r = rallocm(&q, &tsz, sz + 5, 0, ALLOCM_NO_MOVE);
-	if (r != ALLOCM_ERR_NOT_MOVED)
-		malloc_printf("Unexpected rallocm() result\n");
-	if (q != p)
-		malloc_printf("Unexpected object move\n");
-	if (tsz != sz) {
-		malloc_printf("Unexpected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-
-	q = p;
-	r = rallocm(&q, &tsz, sz + 5, 0, 0);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q == p)
-		malloc_printf("Expected object move\n");
-	if (tsz == sz) {
-		malloc_printf("Expected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-	p = q;
-	sz = tsz;
-
-	r = rallocm(&q, &tsz, pagesize*2, 0, 0);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q == p)
-		malloc_printf("Expected object move\n");
-	if (tsz == sz) {
-		malloc_printf("Expected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-	p = q;
-	sz = tsz;
-
-	r = rallocm(&q, &tsz, pagesize*4, 0, 0);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (tsz == sz) {
-		malloc_printf("Expected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-	p = q;
-	sz = tsz;
-
-	r = rallocm(&q, &tsz, pagesize*2, 0, ALLOCM_NO_MOVE);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q != p)
-		malloc_printf("Unexpected object move\n");
-	if (tsz == sz) {
-		malloc_printf("Expected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-	sz = tsz;
-
-	r = rallocm(&q, &tsz, pagesize*4, 0, ALLOCM_NO_MOVE);
-	if (r != ALLOCM_SUCCESS)
-		malloc_printf("Unexpected rallocm() error\n");
-	if (q != p)
-		malloc_printf("Unexpected object move\n");
-	if (tsz == sz) {
-		malloc_printf("Expected size change: %zu --> %zu\n",
-		    sz, tsz);
-	}
-	sz = tsz;
-
-	dallocm(p, 0);
-
-	malloc_printf("Test end\n");
-	return (0);
-}
diff --git a/src/rt/jemalloc/test/rallocm.exp b/src/rt/jemalloc/test/rallocm.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/rallocm.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/thread_arena.c b/src/rt/jemalloc/test/thread_arena.c
deleted file mode 100644
index c5a21fa0c70..00000000000
--- a/src/rt/jemalloc/test/thread_arena.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-#define	NTHREADS 10
-
-void *
-je_thread_start(void *arg)
-{
-	unsigned main_arena_ind = *(unsigned *)arg;
-	void *p;
-	unsigned arena_ind;
-	size_t size;
-	int err;
-
-	p = malloc(1);
-	if (p == NULL) {
-		malloc_printf("%s(): Error in malloc()\n", __func__);
-		return (void *)1;
-	}
-	free(p);
-
-	size = sizeof(arena_ind);
-	if ((err = mallctl("thread.arena", &arena_ind, &size, &main_arena_ind,
-	    sizeof(main_arena_ind)))) {
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		return (void *)1;
-	}
-
-	size = sizeof(arena_ind);
-	if ((err = mallctl("thread.arena", &arena_ind, &size, NULL,
-	    0))) {
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		return (void *)1;
-	}
-	assert(arena_ind == main_arena_ind);
-
-	return (NULL);
-}
-
-int
-main(void)
-{
-	int ret = 0;
-	void *p;
-	unsigned arena_ind;
-	size_t size;
-	int err;
-	je_thread_t threads[NTHREADS];
-	unsigned i;
-
-	malloc_printf("Test begin\n");
-
-	p = malloc(1);
-	if (p == NULL) {
-		malloc_printf("%s(): Error in malloc()\n", __func__);
-		ret = 1;
-		goto label_return;
-	}
-
-	size = sizeof(arena_ind);
-	if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) {
-		malloc_printf("%s(): Error in mallctl(): %s\n", __func__,
-		    strerror(err));
-		ret = 1;
-		goto label_return;
-	}
-
-	for (i = 0; i < NTHREADS; i++) {
-		je_thread_create(&threads[i], je_thread_start,
-		    (void *)&arena_ind);
-	}
-
-	for (i = 0; i < NTHREADS; i++)
-		je_thread_join(threads[i], (void *)&ret);
-
-label_return:
-	malloc_printf("Test end\n");
-	return (ret);
-}
diff --git a/src/rt/jemalloc/test/thread_arena.exp b/src/rt/jemalloc/test/thread_arena.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/thread_arena.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/src/rt/jemalloc/test/thread_tcache_enabled.c b/src/rt/jemalloc/test/thread_tcache_enabled.c
deleted file mode 100644
index 2061b7bbaff..00000000000
--- a/src/rt/jemalloc/test/thread_tcache_enabled.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#define	JEMALLOC_MANGLE
-#include "jemalloc_test.h"
-
-void *
-je_thread_start(void *arg)
-{
-	int err;
-	size_t sz;
-	bool e0, e1;
-
-	sz = sizeof(bool);
-	if ((err = mallctl("thread.tcache.enabled", &e0, &sz, NULL, 0))) {
-		if (err == ENOENT) {
-#ifdef JEMALLOC_TCACHE
-			assert(false);
-#endif
-		}
-		goto label_return;
-	}
-
-	if (e0) {
-		e1 = false;
-		assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz)
-		    == 0);
-		assert(e0);
-	}
-
-	e1 = true;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0 == false);
-
-	e1 = true;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0);
-
-	e1 = false;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0);
-
-	e1 = false;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0 == false);
-
-	free(malloc(1));
-	e1 = true;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0 == false);
-
-	free(malloc(1));
-	e1 = true;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0);
-
-	free(malloc(1));
-	e1 = false;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0);
-
-	free(malloc(1));
-	e1 = false;
-	assert(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz) == 0);
-	assert(e0 == false);
-
-	free(malloc(1));
-label_return:
-	return (NULL);
-}
-
-int
-main(void)
-{
-	int ret = 0;
-	je_thread_t thread;
-
-	malloc_printf("Test begin\n");
-
-	je_thread_start(NULL);
-
-	je_thread_create(&thread, je_thread_start, NULL);
-	je_thread_join(thread, (void *)&ret);
-
-	je_thread_start(NULL);
-
-	je_thread_create(&thread, je_thread_start, NULL);
-	je_thread_join(thread, (void *)&ret);
-
-	je_thread_start(NULL);
-
-	malloc_printf("Test end\n");
-	return (ret);
-}
diff --git a/src/rt/jemalloc/test/thread_tcache_enabled.exp b/src/rt/jemalloc/test/thread_tcache_enabled.exp
deleted file mode 100644
index 369a88dd240..00000000000
--- a/src/rt/jemalloc/test/thread_tcache_enabled.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end