Fix fork(2)-related mutex acquisition order.

Fix mutex acquisition order inversion for the chunks rtree and the base
mutex.  Chunks rtree acquisition was introduced by the previous commit,
so this bug was short-lived.
This commit is contained in:
Jason Evans 2012-10-09 16:16:00 -07:00
parent 20f1fc95ad
commit b5225928fe

View File

@ -1659,9 +1659,9 @@ _malloc_prefork(void)
arena_prefork(arenas[i]); arena_prefork(arenas[i]);
} }
prof_prefork(); prof_prefork();
chunk_prefork();
base_prefork(); base_prefork();
huge_prefork(); huge_prefork();
chunk_prefork();
} }
#ifndef JEMALLOC_MUTEX_INIT_CB #ifndef JEMALLOC_MUTEX_INIT_CB
@ -1681,9 +1681,9 @@ _malloc_postfork(void)
assert(malloc_initialized); assert(malloc_initialized);
/* Release all mutexes, now that fork() has completed. */ /* Release all mutexes, now that fork() has completed. */
chunk_postfork_parent();
huge_postfork_parent(); huge_postfork_parent();
base_postfork_parent(); base_postfork_parent();
chunk_postfork_parent();
prof_postfork_parent(); prof_postfork_parent();
for (i = 0; i < narenas; i++) { for (i = 0; i < narenas; i++) {
if (arenas[i] != NULL) if (arenas[i] != NULL)
@ -1701,9 +1701,9 @@ jemalloc_postfork_child(void)
assert(malloc_initialized); assert(malloc_initialized);
/* Release all mutexes, now that fork() has completed. */ /* Release all mutexes, now that fork() has completed. */
chunk_postfork_child();
huge_postfork_child(); huge_postfork_child();
base_postfork_child(); base_postfork_child();
chunk_postfork_child();
prof_postfork_child(); prof_postfork_child();
for (i = 0; i < narenas; i++) { for (i = 0; i < narenas; i++) {
if (arenas[i] != NULL) if (arenas[i] != NULL)