Lines Matching +full:cfg +full:- +full:space

1 // SPDX-License-Identifier: GPL-2.0
7 //! This module deals with managing the address space of userspace processes. Each process has an
24 #[cfg(CONFIG_MMU)]
30 /// This represents the address space of a userspace process, so each process has one `Mm`
33 /// There is a counter called `mm_users` that counts the users of the address space; this includes
34 /// the userspace process itself, but can also include kernel threads accessing the address space.
35 /// Once `mm_users` reaches zero, this indicates that the address space can be destroyed. To access
36 /// the address space, you must prevent `mm_users` from reaching zero while you are accessing it.
37 /// The [`MmWithUser`] type represents an address space where this is guaranteed, and you can
74 /// This type is like [`Mm`], but with non-zero `mm_users`. It can only be used when `mm_users` can
75 /// be proven to be non-zero at compile-time, usually because the relevant code holds an `mmget`
76 /// refcount. It can be used to access the associated address space.
82 /// Values of this type are always refcounted using `mmget`. The value of `mm_users` is non-zero.
113 fn deref(&self) -> &Mm { in deref()
122 pub fn as_raw(&self) -> *mut bindings::mm_struct { in as_raw()
133 pub unsafe fn from_raw<'a>(ptr: *const bindings::mm_struct) -> &'a Mm { in from_raw()
141 pub fn mmget_not_zero(&self) -> Option<ARef<MmWithUser>> { in mmget_not_zero()
154 // These methods require `mm_users` to be non-zero.
161 /// non-zero for the duration of the lifetime 'a.
163 pub unsafe fn from_raw<'a>(ptr: *const bindings::mm_struct) -> &'a MmWithUser { in from_raw()
174 /// When per-vma locks are disabled, this always returns `None`.
176 pub fn lock_vma_under_rcu(&self, vma_addr: usize) -> Option<VmaReadGuard<'_>> { in lock_vma_under_rcu()
177 #[cfg(CONFIG_PER_VMA_LOCK)] in lock_vma_under_rcu()
180 // `mm_users` is non-zero. in lock_vma_under_rcu()
184 // SAFETY: If `lock_vma_under_rcu` returns a non-null ptr, then it points at a in lock_vma_under_rcu()
193 #[cfg(not(CONFIG_PER_VMA_LOCK))] in lock_vma_under_rcu()
201 pub fn mmap_read_lock(&self) -> MmapReadGuard<'_> { in mmap_read_lock()
214 pub fn mmap_read_trylock(&self) -> Option<MmapReadGuard<'_>> { in mmap_read_trylock()
244 pub fn vma_lookup(&self, vma_addr: usize) -> Option<&virt::VmaRef> { in vma_lookup()
256 // after the MmapReadGuard gets dropped is enforced by the borrow-checker. in vma_lookup()
286 fn deref(&self) -> &VmaRef { in deref()