Commit graph

4 commits

Author SHA1 Message Date
Slobodan Predolac
00f53eb337 Add follow-up test for postfork multithread
Fix FreeBSD postfork child handler never being called: FreeBSD's libthr
calls _malloc_postfork in both parent and child (see freebsd-src
lib/libthr/thread/thr_fork.c), but jemalloc mapped it to the parent
handler only.  Detect the child via getpid() and route to
jemalloc_postfork_child, which resets nthreads and rebuilds the
descriptor queue.

Remove the child_survivor_bytes vs pre_survivor_bytes comparison: on
macOS where jemalloc registers as the default zone, internal allocations
during the postfork handler (pthread_mutex_init) can inflate the
surviving thread's tcache.

Add double-fork test to verify prefork pid is refreshed correctly when a
child process forks again.
2026-05-20 08:57:37 -04:00
Slobodan Predolac
cec4e84c02 Remove obsolete TSD nominal list 2026-05-13 18:27:43 -04:00
Slobodan Predolac
88745978e9 Pass surviving descriptor through jemalloc_postfork_child orchestrator
The orchestrator looks up the surviving descriptor via
tcache_postfork_arena_descriptor and threads it into
arena_postfork_child, eliminating arena's call into tcache. Also reset
cache_bin_array_descriptor_ql_mtx right before the queue rebuild it
protects.
2026-05-13 17:50:41 -04:00
Slobodan Predolac
ba1e2fe4db Extract fork orchestration into jemalloc_fork module 2026-04-30 15:17:18 -04:00