try to simplify the locking code around busy maps.
authordlg <dlg@openbsd.org>
Sun, 20 Oct 2024 11:28:17 +0000 (11:28 +0000)
committerdlg <dlg@openbsd.org>
Sun, 20 Oct 2024 11:28:17 +0000 (11:28 +0000)
commite432ca3c48ac42a9ce6e80286b03fb4270a8a708
tree56ba7d5072cbdca9676fa7007ae47f01bd4d9fb2
parent82ba26c4dcfa3beaa92ff572c369aa66bf298cd9
try to simplify the locking code around busy maps.

vm_maps have a "feature" where they can mark that they're being
operated on by a specific proc, and then release the rwlock protecting
their state. to relock, you have to be the same proc that marked
it busy.

this diff tries to simplify it a bit. it basically has threads check
the busy field up front and rechecks the busy field inside the
rwlock. if you can sleep, it will sleep up front for the busy field
to become clear, rather than sleep on either the busy field or the
rwlock. some code paths clear the busy field without holding the
rwlock, so it doesn't make sense to me to be waiting for the busy
field but sleeping somewhere else.

ok claudio@ mpi@
sys/uvm/uvm_map.c
sys/uvm/uvm_map.h