I'm experimenting with two subtly different approaches for arenas in the hardened malloc implementation (github.com/AndroidHardeni). It already has independent slab allocators for each size class with their own locks, so arenas can be implemented either above or below that layer.
Conversation
End result of having a lock per-size-class-per-arena or per-arena-per-size-class is very similar, but it's going to significantly impact performance and address space layout. Layout matters because x86_64 and arm64 have far from a 64-bit address space so using it wisely matters.
1
Ideally, address space would be abundant enough for each size class to cover all feasible use while having an arena for each core and large gaps. 47 bit x86_64 userspace address space is barely adequate. arm64 offers that, but it's usually not deployed: lwn.net/Articles/59541.
