mm/vma.h
Source file repositories/reference/linux-study-clean/mm/vma.h
File Facts
- System
- Linux kernel
- Corpus path
mm/vma.h- Extension
.h- Size
- 24813 bytes
- Lines
- 757
- Domain
- Core OS
- Bucket
- Memory Management
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct vma_preparestruct unlink_vma_file_batchstruct vma_munmap_structstruct vma_merge_structstruct unmap_descenum vma_merge_statefunction unmap_all_initfunction unmap_pgtable_initfunction vmg_nomemfunction vma_pgoff_offsetfunction vma_iter_store_gfpfunction compat_set_vma_from_descfunction vma_wants_manual_pte_write_upgradefunction vm_pgprot_modifyfunction is_exec_mappingfunction areafunction is_data_mappingfunction is_data_mapping_vma_flagsfunction vma_iter_configfunction vma_iter_resetfunction vma_iter_area_lowestfunction vma_iter_area_highestfunction vma_iter_preallocfunction vma_iter_clearfunction vma_iter_store_overwritefunction vma_iter_store_newfunction vma_iter_addrfunction vma_iter_endfunction vma_is_sealedfunction vma_is_sealedfunction mprotect
Annotated Snippet
* do_mmap() forbids all other combinations.
*/
static inline bool is_stack_mapping(vm_flags_t flags)
{
return ((flags & VM_STACK) == VM_STACK) || (flags & VM_SHADOW_STACK);
}
/*
* Data area - private, writable, not stack
*/
static inline bool is_data_mapping(vm_flags_t flags)
{
return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE;
}
static inline bool is_data_mapping_vma_flags(const vma_flags_t *vma_flags)
{
return vma_flags_test(vma_flags, VMA_WRITE_BIT) &&
!vma_flags_test_any(vma_flags, VMA_SHARED_BIT, VMA_STACK_BIT);
}
static inline void vma_iter_config(struct vma_iterator *vmi,
unsigned long index, unsigned long last)
{
__mas_set_range(&vmi->mas, index, last - 1);
}
static inline void vma_iter_reset(struct vma_iterator *vmi)
{
mas_reset(&vmi->mas);
}
static inline
struct vm_area_struct *vma_iter_prev_range_limit(struct vma_iterator *vmi, unsigned long min)
{
return mas_prev_range(&vmi->mas, min);
}
static inline
struct vm_area_struct *vma_iter_next_range_limit(struct vma_iterator *vmi, unsigned long max)
{
return mas_next_range(&vmi->mas, max);
}
static inline int vma_iter_area_lowest(struct vma_iterator *vmi, unsigned long min,
unsigned long max, unsigned long size)
{
return mas_empty_area(&vmi->mas, min, max - 1, size);
}
static inline int vma_iter_area_highest(struct vma_iterator *vmi, unsigned long min,
unsigned long max, unsigned long size)
{
return mas_empty_area_rev(&vmi->mas, min, max - 1, size);
}
/*
* VMA Iterator functions shared between nommu and mmap
*/
static inline int vma_iter_prealloc(struct vma_iterator *vmi,
struct vm_area_struct *vma)
{
return mas_preallocate(&vmi->mas, vma, GFP_KERNEL);
}
static inline void vma_iter_clear(struct vma_iterator *vmi)
{
mas_store_prealloc(&vmi->mas, NULL);
}
static inline struct vm_area_struct *vma_iter_load(struct vma_iterator *vmi)
{
return mas_walk(&vmi->mas);
}
/* Store a VMA with preallocated memory */
static inline void vma_iter_store_overwrite(struct vma_iterator *vmi,
struct vm_area_struct *vma)
{
vma_assert_attached(vma);
#if defined(CONFIG_DEBUG_VM_MAPLE_TREE)
if (MAS_WARN_ON(&vmi->mas, vmi->mas.status != ma_start &&
vmi->mas.index > vma->vm_start)) {
pr_warn("%lx > %lx\n store vma %lx-%lx\n into slot %lx-%lx\n",
vmi->mas.index, vma->vm_start, vma->vm_start,
vma->vm_end, vmi->mas.index, vmi->mas.last);
}
if (MAS_WARN_ON(&vmi->mas, vmi->mas.status != ma_start &&
vmi->mas.last < vma->vm_start)) {
Annotation
- Detected declarations: `struct vma_prepare`, `struct unlink_vma_file_batch`, `struct vma_munmap_struct`, `struct vma_merge_struct`, `struct unmap_desc`, `enum vma_merge_state`, `function unmap_all_init`, `function unmap_pgtable_init`, `function vmg_nomem`, `function vma_pgoff_offset`.
- Atlas domain: Core OS / Memory Management.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.