STRUCT KVM_PGTABLE_MM_OPS(9)
πΈ struct kvm_pgtable_mm_ops(9) πΈ
okay so bestie, welcome to the Kernel API Manual π this one's a struct page, and it's basically the plug-in pack of memory-management callbacks that the KVM pagetable code calls into whenever it needs a page, a refcount, or a cache flush. Think of it as the group chat between the pgtable walker and whatever allocator you're using. iykyk π«Ά
β¨ NAME β¨
struct kvm_pgtable_mm_ops β Memory management callbacks. literally what it says on the tin, no cap π
π SYNOPSIS π
struct kvm_pgtable_mm_ops {
void* (*zalloc_page)(void *arg);
void* (*zalloc_pages_exact)(size_t size);
void (*free_pages_exact)(void *addr, size_t size);
void (*free_unlinked_table)(void *addr, s8 level);
void (*get_page)(void *addr);
void (*put_page)(void *addr);
int (*page_count)(void *addr);
void* (*phys_to_virt)(phys_addr_t phys);
phys_addr_t (*virt_to_phys)(void *addr);
void (*dcache_clean_inval_poc)(void *addr, size_t size);
void (*icache_inval_pou)(void *addr, size_t size);
};
like, that's the whole vibe right there β
π¦ Members π¦
okay bestie, member-by-member, let's go π₯
zalloc_pageβ Allocate a single zeroed memory page β¨ Theargparameter can be used by the walker to pass a memcache π The initial refcount of the page is1.zalloc_pages_exactβ Allocate an exact number of zeroed memory pages π Thesizeparameter is in bytes, and is rounded up to the next page boundary. The resulting allocation is physically contiguous β yes, physically, she's that girl πfree_pages_exactβ Free an exact number of memory pages previously allocated byzalloc_pages_exactπ«Ά (it's giving "clean up after yourself", we love a responsible icon)free_unlinked_tableβ Free an unlinked paging structure by unlinking and dropping references πget_pageβ Increment the refcount on a page β¬οΈput_pageβ Decrement the refcount on a page β¬οΈ When the refcount reaches0the page is automatically freed. she's gone, periodt πpage_countβ Return the refcount of a page π’phys_to_virtβ Convert a physical address into a virtual address mapped in the current context π§virt_to_physβ Convert a virtual address mapped in the current context into a physical address π¦ (yes she's the reverse of the one above, they're a matching set)dcache_clean_inval_pocβ Clean and invalidate the data cache to the PoC for the specified memory address range π§Όβ¨icache_inval_pouβ Invalidate the instruction cache to the PoU for the specified memory address range π§Ήβ¨
π SEE ALSO π
Kernel file ./arch/arm64/include/asm/kvm_pgtable.h enum kvm_pgtable_stage2_flags(9), enum kvm_pgtable_prot(9), enum kvm_pgtable_walk_flags(9), struct kvm_pgtable_walker(9), struct kvm_pgtable(9), kvm_pgtable_hyp_init(9), kvm_pgtable_hyp_destroy(9), kvm_pgtable_hyp_map(9), kvm_pgtable_hyp_unmap(9), kvm_get_vtcr(9), kvm_pgtable_stage2_pgd_size(9), __kvm_pgtable_stage2_init(9), kvm_pgtable_stage2_destroy(9), kvm_pgtable_stage2_destroy_range(9), kvm_pgtable_stage2_destroy_pgd(9), kvm_pgtable_stage2_free_unlinked(9), kvm_pgtable_stage2_create_unlinked(9), kvm_pgtable_stage2_map(9), kvm_pgtable_stage2_annotate(9), kvm_pgtable_stage2_unmap(9), kvm_pgtable_stage2_wrprotect(9), kvm_pgtable_stage2_mkyoung(9), kvm_pgtable_stage2_test_clear_young(9), kvm_pgtable_stage2_relax_perms(9), kvm_pgtable_stage2_split(9), kvm_pgtable_walk(9), kvm_pgtable_get_leaf(9), kvm_pgtable_stage2_pte_prot(9), kvm_pgtable_hyp_pte_prot(9), kvm_tlb_flush_vmid_range(9)
like, that's a whole friend group right there, go read them all bestie, i believe in you ππ
and that's the page!! π this little love letter lives in ./arch/arm64/include/asm, dropped in October 2026, and it's filed under struct kvm_pgtable_mm_ops(9) in the Kernel API Manual β mwah, slay, go allocate some pages 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