Re:Improving Firefox Responsiveness on macOS
by jupp0r on Monday October 10, 2022 @07:01PM
(#33157420)
My understanding was that allocators nowadays have cache pools per cpu or thread and only rarely need to lock on global state (when imbalances between pool sizes
necessitate shifting resources around).
[ Parent
| on HN ]
Re:Improving Firefox Responsiveness on macOS
by saagarjha on Monday October 10, 2022 @07:43PM
(#33157693)
You are correct, but there are still places where synchronization is necessary.
Re:Improving Firefox Responsiveness on macOS
by gsvelto on Tuesday October 11, 2022 @02:52AM
(#33160207)
They do and so does jemalloc in Firefox, however that lowers contention, it doesn't let you do away with synchronization. Consider this simple scenario: a thread allocates a chunk of memory from its per-thread pool, but the object is later released by another thread. You can't do that w/o synchronization around the pool. Per-CPU pools are even trickier because a thread might be moved around between different CPUs by the scheduler while it's allocating memory. So you need special facilities to implement those in user-space like restartable sequences: https://lwn.net/Articles/650333/