include/linux/mm_inline.h
Source file repositories/reference/linux-study-clean/include/linux/mm_inline.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mm_inline.h- Extension
.h- Size
- 19417 bytes
- Lines
- 671
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/huge_mm.hlinux/mm_types.hlinux/swap.hlinux/string.hlinux/userfaultfd_k.hlinux/leafops.h
Detected Declarations
function foliofunction __update_lru_sizefunction update_lru_sizefunction __folio_clear_lru_flagsfunction folio_lru_listfunction lru_gen_switchingfunction lru_gen_enabledfunction lru_gen_enabledfunction lru_gen_in_faultfunction lru_gen_from_seqfunction lru_hist_from_seqfunction lru_tier_from_refsfunction folio_lru_refsfunction folio_lru_genfunction lru_gen_is_activefunction lru_gen_update_sizefunction lru_gen_folio_seqfunction lru_gen_add_foliofunction lru_gen_del_foliofunction folio_migrate_refsfunction lru_gen_enabledfunction lru_gen_switchingfunction lru_gen_in_faultfunction lru_gen_add_foliofunction lru_gen_del_foliofunction folio_migrate_refsfunction lruvec_add_folio_tailfunction lruvec_del_foliofunction anon_vma_name_getfunction anon_vma_name_putfunction dup_anon_vma_namefunction free_anon_vma_namefunction anon_vma_name_eqfunction anon_vma_name_getfunction init_tlb_flush_pendingfunction inc_tlb_flush_pendingfunction usersfunction mm_tlb_flush_pendingfunction mm_tlb_flush_nestedfunction make_pte_markerfunction pte_install_uffd_wp_if_neededfunction vma_has_recencyfunction num_pages_contiguous
Annotated Snippet
static inline void anon_vma_name_get(struct anon_vma_name *anon_name) {}
static inline void anon_vma_name_put(struct anon_vma_name *anon_name) {}
static inline void dup_anon_vma_name(struct vm_area_struct *orig_vma,
struct vm_area_struct *new_vma) {}
static inline void free_anon_vma_name(struct vm_area_struct *vma) {}
static inline bool anon_vma_name_eq(struct anon_vma_name *anon_name1,
struct anon_vma_name *anon_name2)
{
return true;
}
#endif /* CONFIG_ANON_VMA_NAME */
void pfnmap_track_ctx_release(struct kref *ref);
static inline void init_tlb_flush_pending(struct mm_struct *mm)
{
atomic_set(&mm->tlb_flush_pending, 0);
}
static inline void inc_tlb_flush_pending(struct mm_struct *mm)
{
atomic_inc(&mm->tlb_flush_pending);
/*
* The only time this value is relevant is when there are indeed pages
* to flush. And we'll only flush pages after changing them, which
* requires the PTL.
*
* So the ordering here is:
*
* atomic_inc(&mm->tlb_flush_pending);
* spin_lock(&ptl);
* ...
* set_pte_at();
* spin_unlock(&ptl);
*
* spin_lock(&ptl)
* mm_tlb_flush_pending();
* ....
* spin_unlock(&ptl);
*
* flush_tlb_range();
* atomic_dec(&mm->tlb_flush_pending);
*
* Where the increment if constrained by the PTL unlock, it thus
* ensures that the increment is visible if the PTE modification is
* visible. After all, if there is no PTE modification, nobody cares
* about TLB flushes either.
*
* This very much relies on users (mm_tlb_flush_pending() and
* mm_tlb_flush_nested()) only caring about _specific_ PTEs (and
* therefore specific PTLs), because with SPLIT_PTE_PTLOCKS and RCpc
* locks (PPC) the unlock of one doesn't order against the lock of
* another PTL.
*
* The decrement is ordered by the flush_tlb_range(), such that
* mm_tlb_flush_pending() will not return false unless all flushes have
* completed.
*/
}
static inline void dec_tlb_flush_pending(struct mm_struct *mm)
{
/*
* See inc_tlb_flush_pending().
*
* This cannot be smp_mb__before_atomic() because smp_mb() simply does
* not order against TLB invalidate completion, which is what we need.
*
* Therefore we must rely on tlb_flush_*() to guarantee order.
*/
atomic_dec(&mm->tlb_flush_pending);
}
static inline bool mm_tlb_flush_pending(const struct mm_struct *mm)
{
/*
* Must be called after having acquired the PTL; orders against that
* PTLs release and therefore ensures that if we observe the modified
* PTE we must also observe the increment from inc_tlb_flush_pending().
*
* That is, it only guarantees to return true if there is a flush
* pending for _this_ PTL.
*/
return atomic_read(&mm->tlb_flush_pending);
}
static inline bool mm_tlb_flush_nested(const struct mm_struct *mm)
{
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/huge_mm.h`, `linux/mm_types.h`, `linux/swap.h`, `linux/string.h`, `linux/userfaultfd_k.h`, `linux/leafops.h`.
- Detected declarations: `function folio`, `function __update_lru_size`, `function update_lru_size`, `function __folio_clear_lru_flags`, `function folio_lru_list`, `function lru_gen_switching`, `function lru_gen_enabled`, `function lru_gen_enabled`, `function lru_gen_in_fault`, `function lru_gen_from_seq`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.