haiku/headers
Augustin Cavalier 08c53ca964 kernel/vm: Use more than one object_cache for the page mappings.
Every time a page is mapped into an area on fault, we have to
allocate a mapping object for it. While the object_cache
does have per-CPU depots, these depots only store a limited
number of items, and once they run out the object_cache's lock
must be acquired.

So, to reduce lock contention on SMP systems, create a number
of object caches corresponding to the nearest power of 2
that is equal or smaller than the count of CPUs. (We already
allocate dozens of object caches for the block allocator
no matter how many CPUs there are, so a few more depending
on CPU count shouldn't impact memory use too much. Besides,
the object_caches are wired into the low_resource system.)

This significantly reduces lock contention on SMP systems.
Same benchmark setup as yesterday (compile mime_db and relink
HaikuDepot, VMware, -j4), before:
real    0m16.981s
user    0m14.357s
sys     0m6.060s

after:
real    0m14.522s
user    0m14.194s
sys     0m4.337s

And the page_mappings object_cache locks went from having 200,000+ waits
and ~14 seconds waiting time (across all threads) down to ~900 (yes,
that's not a typo) and ~0.05s wait time (though these numbers were captured
in conjunction with the following commit.)
2024-07-24 16:31:20 -04:00
..
build elf: add PT_RISCV_ATTRIBUTES program header 2023-09-25 15:20:13 +00:00
compatibility pthread: Implement pthread_timedjoin_np. 2024-07-16 19:59:39 +00:00
config
cpp userlandfs: use std::bitset for FSCapabilities 2023-07-10 06:27:18 +00:00
glibc
libs udis86: remove 2024-07-17 19:11:50 +00:00
os runtime_loader: Add support for DT_GNU_HASH. 2024-07-23 23:24:36 +00:00
posix POSIX: move getentropy(2) from libbsd 2024-07-16 16:09:00 +00:00
private kernel/vm: Use more than one object_cache for the page mappings. 2024-07-24 16:31:20 -04:00
tools