Rather than trying to make jemalloc support general reentrancy, we could instead make it possible to manually enter a reentrancy-capable mode only during risky operations, i.e. system calls and other risky external library function calls such as those related to collecting backtraces. This would probably be sufficiently general to meet all needs, and it could be implemented such that the fast paths suffer only the addition of a single (well predicted) conditional branch that is not normally taken.