pub struct MmWithUserAsync { /* private fields */ }Expand description
A wrapper for the kernel’s struct mm_struct.
This type is identical to MmWithUser except that it uses mmput_async when dropping a
refcount. This means that the destructor of ARef<MmWithUserAsync> is safe to call in atomic
context.
§Invariants
Values of this type are always refcounted using mmget. The value of mm_users is non-zero.
Methods from Deref<Target = MmWithUser>§
Sourcepub fn lock_vma_under_rcu(&self, vma_addr: usize) -> Option<VmaReadGuard<'_>>
pub fn lock_vma_under_rcu(&self, vma_addr: usize) -> Option<VmaReadGuard<'_>>
Attempt to access a vma using the vma read lock.
This is an optimistic trylock operation, so it may fail if there is contention. In that case, you should fall back to taking the mmap read lock.
Sourcepub fn vma_start_read_unlocked(
&self,
vma_addr: usize,
) -> Option<VmaReadGuard<'_>>
pub fn vma_start_read_unlocked( &self, vma_addr: usize, ) -> Option<VmaReadGuard<'_>>
Find the VMA covering ‘address’ and read-lock it.
The fast path does not take mmap_lock. Waits for writers to finish if the VMA is being modified by taking mmap_lock. Use when mmap_lock is not held, otherwise use vma_start_read_locked(). Nothing prevents VMAs being unmapped/mapped before or after the VMA is looked up, if a stronger guarantee is required, take an mmap_lock.
Return: If a VMA exists which spans @address, return that VMA, read-locked. If no VMA is mapped there or, very unlikely, a reference count overflow occurred, return NULL.
Sourcepub fn mmap_read_lock(&self) -> MmapReadGuard<'_>
pub fn mmap_read_lock(&self) -> MmapReadGuard<'_>
Lock the mmap read lock.
Sourcepub fn mmap_read_trylock(&self) -> Option<MmapReadGuard<'_>>
pub fn mmap_read_trylock(&self) -> Option<MmapReadGuard<'_>>
Try to lock the mmap read lock.
Methods from Deref<Target = Mm>§
Sourcepub fn mmget_not_zero(&self) -> Option<ARef<MmWithUser>>
pub fn mmget_not_zero(&self) -> Option<ARef<MmWithUser>>
Calls mmget_not_zero and returns a handle if it succeeds.
Trait Implementations§
Source§impl AlwaysRefCounted for MmWithUserAsync
impl AlwaysRefCounted for MmWithUserAsync
Source§impl Deref for MmWithUserAsync
impl Deref for MmWithUserAsync
Source§type Target = MmWithUser
type Target = MmWithUser
Source§fn deref(&self) -> &MmWithUser
fn deref(&self) -> &MmWithUser
impl Send for MmWithUserAsync
impl Sync for MmWithUserAsync
Auto Trait Implementations§
impl !Freeze for MmWithUserAsync
impl !RefUnwindSafe for MmWithUserAsync
impl !Unpin for MmWithUserAsync
impl !UnsafeUnpin for MmWithUserAsync
impl UnwindSafe for MmWithUserAsync
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
self into a T. This operation is guaranteed to be lossless.