haiku/headers
Augustin Cavalier c650846d9e vm: Replace the VMAreas OpenHashTable with an AVLTree.
Since we used a hash table with a fixed size (1024), collisions were
obviously inevitable, meaning that while insertions would always be
fast, lookups and deletions would take linear time to search the
linked-list for the area in question. For recently-created areas,
this would be fast; for less-recently-created areas, it would get
slower and slower and slower.

A particularly pathological case was the "mmap/24-1" test from the
Open POSIX Testsuite, which creates millions of areas until it hits
ENOMEM; it then simply exits, at which point it would run for minutes
and minutes in the kernel team deletion routines; how long I don't know,
as I rebooted before it finished.

This change fixes that problem, among others, at the cost of increased
area creation time, by using an AVL tree instead of a hash. For comparison,
mmap'ing 2 million areas with the "24-1" test before this change took
around 0m2.706s of real time, while afterwards it takes about 0m3.118s,
or around a 15% increase (1.152x).

On the other hand, the total test runtime for 2 million areas went from
around 2m11.050s to 0m4.035s, or around a 97% decrease (0.031x); in other
words, with this new code, it is *32 times faster.*

Area insertion will no longer be O(1), however, so the time increase
may go up with the number of areas present on the system; but if it's
only around 3 seconds to create 2 million areas, or about 1.56 us per area,
vs. 1.35 us before, I don't think that's worth worrying about.

My nonscientific "compile HaikuDepot with 2 cores in VM" benchmark
seems to be within the realm of "noise", anyway, with most results
both before and after this change coming in around 47s real time.

Change-Id: I230e17de4f80304d082152af83db8bd5abe7b831
2023-03-24 10:53:52 -04:00
..
build libroot_build & fs_shell: Provide _kern_ functions for readv/writev... 2023-02-14 00:49:52 -05:00
compatibility sys/uio: Add preadv/pwritev. 2023-02-24 16:31:51 +00:00
config riscv: cleanup architecture macro checks 2021-09-01 18:04:59 +00:00
cpp
glibc
libs Removed 'register' storage class compiler warnings 2022-09-12 14:03:28 +00:00
os BMenuField: allow to use non-fixed size in combination with layout mode 2023-02-21 10:47:46 +00:00
posix kernel/arm: implement signals, fork, restart syscall 2023-03-20 17:28:20 +00:00
private vm: Replace the VMAreas OpenHashTable with an AVLTree. 2023-03-24 10:53:52 -04:00
tools cppunit: Enable CPPUNIT_HAVE_SSTREAM for the non-legacy GCC. 2022-03-29 19:09:38 -04:00