mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 01:27:19 +03:00
Fix arena_prefork lock rank order for witness.
When witness is enabled, lock rank order needs to be preserved during prefork, not only for each arena, but also across arenas. This change breaks arena_prefork into further stages to ensure valid rank order across arenas. Also changed test/unit/fork to use a manual arena to catch this case.
This commit is contained in:
parent
8adab26972
commit
8721e19c04
5 changed files with 49 additions and 12 deletions
|
|
@ -9,6 +9,19 @@ TEST_BEGIN(test_fork) {
|
|||
void *p;
|
||||
pid_t pid;
|
||||
|
||||
/* Set up a manually managed arena for test. */
|
||||
unsigned arena_ind;
|
||||
size_t sz = sizeof(unsigned);
|
||||
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0),
|
||||
0, "Unexpected mallctl() failure");
|
||||
|
||||
/* Migrate to the new arena. */
|
||||
unsigned old_arena_ind;
|
||||
sz = sizeof(old_arena_ind);
|
||||
assert_d_eq(mallctl("thread.arena", (void *)&old_arena_ind, &sz,
|
||||
(void *)&arena_ind, sizeof(arena_ind)), 0,
|
||||
"Unexpected mallctl() failure");
|
||||
|
||||
p = malloc(1);
|
||||
assert_ptr_not_null(p, "Unexpected malloc() failure");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue