diff options
author | alc <alc@FreeBSD.org> | 2002-12-31 19:38:04 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-12-31 19:38:04 +0000 |
commit | 1842adc3403fdfdfa5e7a5e3aeedc2ad30a51fdc (patch) | |
tree | f466821885587addd092988b12cd19471611e5be /sys/vm/vm_map.h | |
parent | f1a17aa7f4b46931b6a4109ec823885c76d6b614 (diff) | |
download | FreeBSD-src-1842adc3403fdfdfa5e7a5e3aeedc2ad30a51fdc.zip FreeBSD-src-1842adc3403fdfdfa5e7a5e3aeedc2ad30a51fdc.tar.gz |
Implement a variant locking scheme for vm maps: Access to system maps
is now synchronized by a mutex, whereas access to user maps is still
synchronized by a lockmgr()-based lock. Why? No single type of lock,
including sx locks, meets the requirements of both types of vm map.
Sometimes we sleep while holding the lock on a user map. Thus, a
a mutex isn't appropriate. On the other hand, both lockmgr()-based
and sx locks release Giant when a thread/process blocks during
contention for a lock. This could lead to a race condition in a legacy
driver (that relies on Giant for synchronization) if it attempts to
kmem_malloc() and fails to immediately obtain the lock. Fortunately,
we never sleep while holding a system map lock.
Diffstat (limited to 'sys/vm/vm_map.h')
-rw-r--r-- | sys/vm/vm_map.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 2f629c6..d95d197 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -164,6 +164,7 @@ vm_map_entry_behavior(vm_map_entry_t entry) struct vm_map { struct vm_map_entry header; /* List of entries */ struct lock lock; /* Lock for map data */ + struct mtx system_mtx; int nentries; /* Number of entries */ vm_size_t size; /* virtual size */ u_char needs_wakeup; |