aboutsummaryrefslogtreecommitdiff
path: root/test/unit/huge.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-02-05 23:20:13 +0000
committerWarner Losh <imp@FreeBSD.org>2025-02-05 23:20:13 +0000
commit48ec896efb0b78141df004eaa21288b84590c9da (patch)
tree33799792fd95c266d472ab1ae51d50ab4f942eb3 /test/unit/huge.c
parentd28d7fbede216494aa3942af042cc084fcd6098a (diff)
jemalloc: Import 5.3.0 54eaed1d8b56b1aa528be3bdd1877e59c56fa90cvendor/jemalloc/5.3.0vendor/jemalloc
Import jemalloc 5.3.0. This import changes how manage the jemalloc vendor branch (which was just started anyway). Starting with 5.3.0, we import a clean tree from the upstream github, removing all the old files that are no longer upstream, or that we've kept around for some reason. We do this because we merge from this raw version of jemalloc into the FreeBSD contrib/jemalloc, then we run autogen stuff, generate all the generated .h files with gmake, then finally remove much of the generated files in contrib/jemalloc using an update script. Sponsored by: Netflix
Diffstat (limited to 'test/unit/huge.c')
-rw-r--r--test/unit/huge.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/test/unit/huge.c b/test/unit/huge.c
index ab72cf007102..ec64e5002d6d 100644
--- a/test/unit/huge.c
+++ b/test/unit/huge.c
@@ -11,37 +11,37 @@ TEST_BEGIN(huge_bind_thread) {
size_t sz = sizeof(unsigned);
/* Bind to a manual arena. */
- assert_d_eq(mallctl("arenas.create", &arena1, &sz, NULL, 0), 0,
+ expect_d_eq(mallctl("arenas.create", &arena1, &sz, NULL, 0), 0,
"Failed to create arena");
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena1,
+ expect_d_eq(mallctl("thread.arena", NULL, NULL, &arena1,
sizeof(arena1)), 0, "Fail to bind thread");
void *ptr = mallocx(HUGE_SZ, 0);
- assert_ptr_not_null(ptr, "Fail to allocate huge size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
+ expect_ptr_not_null(ptr, "Fail to allocate huge size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
sizeof(ptr)), 0, "Unexpected mallctl() failure");
- assert_u_eq(arena1, arena2, "Wrong arena used after binding");
+ expect_u_eq(arena1, arena2, "Wrong arena used after binding");
dallocx(ptr, 0);
/* Switch back to arena 0. */
test_skip_if(have_percpu_arena &&
PERCPU_ARENA_ENABLED(opt_percpu_arena));
arena2 = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena2,
+ expect_d_eq(mallctl("thread.arena", NULL, NULL, &arena2,
sizeof(arena2)), 0, "Fail to bind thread");
ptr = mallocx(SMALL_SZ, MALLOCX_TCACHE_NONE);
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
sizeof(ptr)), 0, "Unexpected mallctl() failure");
- assert_u_eq(arena2, 0, "Wrong arena used after binding");
+ expect_u_eq(arena2, 0, "Wrong arena used after binding");
dallocx(ptr, MALLOCX_TCACHE_NONE);
/* Then huge allocation should use the huge arena. */
ptr = mallocx(HUGE_SZ, 0);
- assert_ptr_not_null(ptr, "Fail to allocate huge size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
+ expect_ptr_not_null(ptr, "Fail to allocate huge size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
sizeof(ptr)), 0, "Unexpected mallctl() failure");
- assert_u_ne(arena2, 0, "Wrong arena used after binding");
- assert_u_ne(arena1, arena2, "Wrong arena used after binding");
+ expect_u_ne(arena2, 0, "Wrong arena used after binding");
+ expect_u_ne(arena1, arena2, "Wrong arena used after binding");
dallocx(ptr, 0);
}
TEST_END
@@ -50,22 +50,22 @@ TEST_BEGIN(huge_mallocx) {
unsigned arena1, arena2;
size_t sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.create", &arena1, &sz, NULL, 0), 0,
+ expect_d_eq(mallctl("arenas.create", &arena1, &sz, NULL, 0), 0,
"Failed to create arena");
void *huge = mallocx(HUGE_SZ, MALLOCX_ARENA(arena1));
- assert_ptr_not_null(huge, "Fail to allocate huge size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &huge,
+ expect_ptr_not_null(huge, "Fail to allocate huge size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &huge,
sizeof(huge)), 0, "Unexpected mallctl() failure");
- assert_u_eq(arena1, arena2, "Wrong arena used for mallocx");
+ expect_u_eq(arena1, arena2, "Wrong arena used for mallocx");
dallocx(huge, MALLOCX_ARENA(arena1));
void *huge2 = mallocx(HUGE_SZ, 0);
- assert_ptr_not_null(huge, "Fail to allocate huge size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &huge2,
+ expect_ptr_not_null(huge, "Fail to allocate huge size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &huge2,
sizeof(huge2)), 0, "Unexpected mallctl() failure");
- assert_u_ne(arena1, arena2,
+ expect_u_ne(arena1, arena2,
"Huge allocation should not come from the manual arena.");
- assert_u_ne(arena2, 0,
+ expect_u_ne(arena2, 0,
"Huge allocation should not come from the arena 0.");
dallocx(huge2, 0);
}
@@ -75,25 +75,25 @@ TEST_BEGIN(huge_allocation) {
unsigned arena1, arena2;
void *ptr = mallocx(HUGE_SZ, 0);
- assert_ptr_not_null(ptr, "Fail to allocate huge size");
+ expect_ptr_not_null(ptr, "Fail to allocate huge size");
size_t sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.lookup", &arena1, &sz, &ptr, sizeof(ptr)),
+ expect_d_eq(mallctl("arenas.lookup", &arena1, &sz, &ptr, sizeof(ptr)),
0, "Unexpected mallctl() failure");
- assert_u_gt(arena1, 0, "Huge allocation should not come from arena 0");
+ expect_u_gt(arena1, 0, "Huge allocation should not come from arena 0");
dallocx(ptr, 0);
ptr = mallocx(HUGE_SZ >> 1, 0);
- assert_ptr_not_null(ptr, "Fail to allocate half huge size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
+ expect_ptr_not_null(ptr, "Fail to allocate half huge size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
sizeof(ptr)), 0, "Unexpected mallctl() failure");
- assert_u_ne(arena1, arena2, "Wrong arena used for half huge");
+ expect_u_ne(arena1, arena2, "Wrong arena used for half huge");
dallocx(ptr, 0);
ptr = mallocx(SMALL_SZ, MALLOCX_TCACHE_NONE);
- assert_ptr_not_null(ptr, "Fail to allocate small size");
- assert_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
+ expect_ptr_not_null(ptr, "Fail to allocate small size");
+ expect_d_eq(mallctl("arenas.lookup", &arena2, &sz, &ptr,
sizeof(ptr)), 0, "Unexpected mallctl() failure");
- assert_u_ne(arena1, arena2,
+ expect_u_ne(arena1, arena2,
"Huge and small should be from different arenas");
dallocx(ptr, 0);
}