phkmalloc
phk.freebsd.dk
phk.freebsd.dk
* https://en.wikipedia.org/wiki/Poul-Henning_Kamp
Amongst other things (including jails), he invented the MD5crypt algorithm (originally for FreeBSD) as an alternative to the original DEScrypt of Unix:
* https://en.wikipedia.org/wiki/Crypt_(C)#MD5-based_scheme
Nowadays probably most well-known for creating Varnish:
phk?
In a text editor - got a nod, and we shook hands :)> First I thought “We’re not having any of that” and made phkmalloc abort(2) on any wrong usage. Next time I rebooted my laptop fsck(8) aborted, and left me in single user mode until I could fix things with a floppy disk.
I love everything about this anecdote.
Wow, what an incredible experience!
It's definitely a clever hack given the constraints of malloc, but this anecdote made me smile very widely.
In addition to multi-core becoming the norm causing it to be less performant than alternatives, I imagine the "sanity checking" aspects of phkmalloc were subsumed by things like ASAN.
- "NSA Operation ORCHESTRA: Annual Status Report": https://mirrors.dotsrc.org/fosdem/2014/Janson/Sunday/NSA_ope...
- The bikeshed email: https://phk.freebsd.dk/sagas/bikeshed/
At the time I didn't think much about how the allocators could help as they're constrained to the ABI. Writing in Zig with custom allocators for everything would. The only mysql NUMA setting was innodb_numa_interleave=ON which wasn't very good but not a lot worse than trying harder.
If you have a lot of cross thread memory use, maybe you need something to help with allocate on core X, free on core Y and the cross core communication that causes (maybe that's already in place?).
There's more memory overhead that way, but large core count systems tend to have a lot of memory too.
Note that that can have an awkward effect: if the thread gets parked (either entirely, or just stops calling the allocator because it has reached its steady state), the allocator may never have the opportunity to release that thread's memory. IIRC mimalloc suffers from this issue, you need to call an allocator specific API to tell it about the regime change.