include/linux/mm_types.h
Source file repositories/reference/linux-study-clean/include/linux/mm_types.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mm_types.h- Extension
.h- Size
- 64816 bytes
- Lines
- 2005
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/mm_types_task.hlinux/auxvec.hlinux/kref.hlinux/list.hlinux/spinlock.hlinux/rbtree.hlinux/maple_tree.hlinux/rwsem.hlinux/completion.hlinux/cpumask.hlinux/uprobes.hlinux/rcupdate.hlinux/page-flags-layout.hlinux/workqueue.hlinux/seqlock.hlinux/percpu_counter.hlinux/types.hlinux/futex_types.hlinux/rseq_types.hlinux/bitmap.hasm/mmu.h
Detected Declarations
struct address_spacestruct futex_private_hashstruct mem_cgroupstruct pagestruct encoded_pagestruct foliostruct ptdescstruct vm_regionstruct vm_userfaultfd_ctxstruct vm_userfaultfd_ctxstruct anon_vma_namestruct vma_numab_statestruct pfnmap_track_ctxstruct mmap_actionstruct vm_area_descstruct vm_area_structstruct kioctx_tablestruct iommu_mm_datastruct mm_structstruct lru_gen_mm_liststruct vma_iteratorstruct mmu_gatherstruct vm_faultstruct vm_special_mappingenum mmap_action_typeenum vm_fault_reasonenum tlb_flush_reasonenum fault_flagfunction encoded_page_flagsfunction encoded_nr_pagesfunction ptdesc_pmd_pts_initfunction ptdesc_pmd_pts_incfunction ptdesc_pmd_pts_decfunction ptdesc_pmd_pts_countfunction ptdesc_pmd_is_sharedfunction ptdesc_pmd_pts_initfunction vma_flags_emptyfunction vma_flags_clear_allfunction vma_flags_to_legacyfunction vma_flags_overwrite_wordfunction legacy_to_vma_flagsfunction vma_flags_overwrite_word_oncefunction vma_flags_set_wordfunction vma_flags_clear_wordfunction __mm_flags_overwrite_wordfunction __mm_flags_get_wordfunction __mm_flags_set_mask_bits_wordfunction mm_init_cpumask
Annotated Snippet
struct page {
memdesc_flags_t flags; /* Atomic flags, some possibly
* updated asynchronously */
/*
* Five words (20/40 bytes) are available in this union.
* WARNING: bit 0 of the first word is used for PageTail(). That
* means the other users of this union MUST NOT use the bit to
* avoid collision and false-positive PageTail().
*/
union {
struct { /* Page cache and anonymous pages */
/**
* @lru: Pageout list, eg. active_list protected by
* lruvec->lru_lock. Sometimes used as a generic list
* by the page owner.
*/
union {
struct list_head lru;
/* Or, free page */
struct list_head buddy_list;
struct list_head pcp_list;
struct llist_node pcp_llist;
};
struct address_space *mapping;
union {
pgoff_t __folio_index; /* Our offset within mapping. */
unsigned long share; /* share count for fsdax */
};
/**
* @private: Mapping-private opaque data.
* Usually used for buffer_heads if PagePrivate.
* Used for swp_entry_t if swapcache flag set.
* Indicates order in the buddy system if PageBuddy
* or on pcp_llist.
*/
unsigned long private;
};
struct { /* page_pool used by netstack */
/**
* @pp_magic: magic value to avoid recycling non
* page_pool allocated pages.
*/
unsigned long pp_magic;
struct page_pool *pp;
unsigned long _pp_mapping_pad;
unsigned long dma_addr;
atomic_long_t pp_ref_count;
};
struct { /* Tail pages of compound page */
unsigned long compound_info; /* Bit zero is set */
};
struct { /* ZONE_DEVICE pages */
/*
* The first word is used for compound_info or folio
* pgmap
*/
void *_unused_pgmap_compound_info;
void *zone_device_data;
/*
* ZONE_DEVICE private pages are counted as being
* mapped so the next 3 words hold the mapping, index,
* and private fields from the source anonymous or
* page cache page while the page is migrated to device
* private memory.
* ZONE_DEVICE MEMORY_DEVICE_FS_DAX pages also
* use the mapping, index, and private fields when
* pmem backed DAX files are mapped.
*/
};
/** @rcu_head: You can use this to free a page by RCU. */
struct rcu_head rcu_head;
};
union { /* This union is 4 bytes in size. */
/*
* For head pages of typed folios, the value stored here
* allows for determining what this page is used for. The
* tail pages of typed folios will not store a type
* (page_type == _mapcount == -1).
*
* See page-flags.h for a list of page types which are currently
* stored here.
*
* Owners of typed folios may reuse the lower 16 bit of the
* head page page_type field after setting the page type,
* but must reset these 16 bit to -1 before clearing the
* page type.
*/
Annotation
- Immediate include surface: `linux/mm_types_task.h`, `linux/auxvec.h`, `linux/kref.h`, `linux/list.h`, `linux/spinlock.h`, `linux/rbtree.h`, `linux/maple_tree.h`, `linux/rwsem.h`.
- Detected declarations: `struct address_space`, `struct futex_private_hash`, `struct mem_cgroup`, `struct page`, `struct encoded_page`, `struct folio`, `struct ptdesc`, `struct vm_region`, `struct vm_userfaultfd_ctx`, `struct vm_userfaultfd_ctx`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.