1 Locks/Reference Counting:
4 sem R/W for area creation/deletion and any other address space changes
5 fields: areas, area_hint (is currently written in vm_area_lookup() without a write lock!),
7 ref_count: ensures validity of object beyond team lifetime,
8 retrieved via the global sAddressSpaceTable's pointer (which is guarded by
10 vm_address_space_walk_next() is unsafe! (and obsolete, only used by the former
12 Problems: resize_area() does not lock any address spaces yet, but needs to lock all clones
15 ref_count: ensures validity
16 retrieved via the global sAreaHash's pointer (which is guarded by
18 vs. vm_area_lookup() which iterates over the address space's area list, not
19 the hash - therefore, it checks ref_count against NULL (ugly)
21 size, protection: essentially unguarded! (can be changed by resize_area()
22 and set_area_protection())
23 mappings: guarded by the global sMappingLock (currently a spinlock)
24 address_space_next: vm_address_space::sem
25 hash_next: sAreaHashLock
26 cache: guarded by vm_area_get_locked_cache()/sAreaCacheLock
27 cache_next|prev: cache_ref::lock
30 ref_count: ensures validity
31 vm_cache_remove_consumer(): does scary things with the ref_count
32 fault_acquire_locked_source(): tries to get a ref through the vm_cache
33 cache, areas: guarded by lock
36 all fields: guarded by ref::lock
37 BUT: ref may change, therefore it's generally unsafe to go from cache to ref
38 without holding the ref's lock (which happens, by design, in vm_cache::source
39 and vm_cache::consumers)!
42 hash_next: guarded by sPageCacheTableLock spinlock
43 queue_prev|next: guarded by sPageLock
44 cache_prev|next, cache, cache_offset: guarded by vm_cache_ref::lock
45 mappings: guarded by the global sMappingLock (currently a spinlock)
46 state: in vm_page only used with the sPageLock held, other uses have the
47 cache locked the page is in
48 wired_count, usage_count: not guarded? TBD
49 busy_reading, busy_writing: dummy pages only