STRUCT PTDESC(9)
β¨ NAME β¨
okay so bestie, this is struct ptdesc(9) from the Kernel API Manual β literally the Memory descriptor for page tables. Thatβs the whole vibe. π
π§ SYNOPSIS π§
Hereβs the full struct, exactly as it appears, because we do not mess with C source in this group chat:
struct ptdesc {
memdesc_flags_t pt_flags;
union {
struct rcu_head pt_rcu_head;
struct list_head pt_list;
struct {
unsigned long _pt_pad_1;
pgtable_t pmd_huge_pte;
};
};
unsigned long __page_mapping;
union {
pgoff_t pt_index;
struct mm_struct *pt_mm;
atomic_t pt_frag_refcount;
#ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING;
atomic_t pt_share_count;
#endif;
};
union {
unsigned long _pt_pad_2;
#if ALLOC_SPLIT_PTLOCKS;
spinlock_t *ptl;
#else;
spinlock_t ptl;
#endif;
};
unsigned int __page_type;
atomic_t __page_refcount;
#ifdef CONFIG_MEMCG;
unsigned long pt_memcg_data;
#endif;
};
π― Members π―
okay, meet the cast β every single member, no skips, no βweβll come back to it laterβ energy:
pt_flagsβenum pt_flagsplus zone/node/section.{unnamed_union}β anonymous.pt_rcu_headβ For freeing page table pages.pt_listβ List of used page tables. Used for s390 gmap shadow pages (which are not linked into the user page tables) and x86 pgds.{unnamed_struct}β anonymous._pt_pad_1β Padding that aliases with page's compound head.pmd_huge_pteβ Protected byptdesc->ptl, used for THPs.__page_mappingβ Aliases withpage->mapping. Unused for page tables.{unnamed_union}β anonymous.pt_indexβ Used for s390 gmap.pt_mmβ Used for x86 pgds.pt_frag_refcountβ For fragmented page table tracking. Powerpc only.pt_share_countβ Used for HugeTLB PMD page table share count.{unnamed_union}β anonymous._pt_pad_2β Padding to ensure proper alignment.ptlβ Lock for the page table.ptlβ Lock for the page table.__page_typeβ Same aspage->page_type. Unused for page tables.__page_refcountβ Same as page refcount.pt_memcg_dataβ Memcg data. Tracked for page tables here.
π Description π
This struct overlays struct page for now. Do not modify without a good understanding of the issues.
bestie, that is a real warning β do not just roll up and start changing things unless you actually understand the issues. like, fr fr. π
π SEE ALSO π
Kernel file ./include/linux/mm_types.h β also go peek at softleaf_t(9), struct folio(9), vm_fault_t(9), enum vm_fault_reason(9), and enum fault_flag(9). iykyk π¦
β¨ cute little sign-off: source/version./include/linux, dateOctober 2026, pagestruct ptdesc(9)β bye bestie, slay responsibly ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms