pub struct VmaReadGuard<'a> { /* private fields */ }
Expand description
Methods from Deref<Target = VmaRef>§
Sourcepub fn mm(&self) -> &MmWithUser
pub fn mm(&self) -> &MmWithUser
Access the underlying mm_struct
.
Sourcepub fn flags(&self) -> vm_flags_t
pub fn flags(&self) -> vm_flags_t
Returns the flags associated with the virtual memory area.
The possible flags are a combination of the constants in flags
.
Sourcepub fn zap_page_range_single(&self, address: usize, size: usize)
pub fn zap_page_range_single(&self, address: usize, size: usize)
Zap pages in the given page range.
This clears page table mappings for the range at the leaf level, leaving all other page tables intact, and freeing any memory referenced by the VMA in this range. That is, anonymous memory is completely freed, file-backed memory has its reference count on page cache folio’s dropped, any dirty data will still be written back to disk as usual.
It may seem odd that we clear at the leaf level, this is however a product of the page table structure used to map physical memory into a virtual address space - each virtual address actually consists of a bitmap of array indices into page tables, which form a hierarchical page table level structure.
As a result, each page table level maps a multiple of page table levels below, and thus span ever increasing ranges of pages. At the leaf or PTE level, we map the actual physical memory.
It is here where a zap operates, as it the only place we can be certain of clearing without impacting any other virtual mappings. It is an implementation detail as to whether the kernel goes further in freeing unused page tables, but for the purposes of this operation we must only assume that the leaf level is cleared.
Sourcepub fn as_mixedmap_vma(&self) -> Option<&VmaMixedMap>
pub fn as_mixedmap_vma(&self) -> Option<&VmaMixedMap>
If the VM_MIXEDMAP
flag is set, returns a VmaMixedMap
to this VMA, otherwise
returns None
.
This can be used to access methods that require VM_MIXEDMAP
to be set.