free_pgtables(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… free_pgtables(9)

okay so this is one of those kernel API manual pages β€” section 9, bestie, we're in the deep internals now 🫢 β€” and it's literally about freeing a range of page tables. yes, the actual page tables. the scaffolding under the scaffolding. we love a cleanup arc ✨


🌸 NAME 🌸

free_pgtables β€” frees a range of page tables, no cap, that's the whole job πŸ’…


⭐ SYNOPSIS ⭐

void free_pgtables (struct mmu_gather *tlb , struct unmap_desc *unmap );

like, that's it. that's the whole signature. void return, two pointers in, page tables out (of existence) πŸ”₯


πŸŽ€ ARGUMENTS πŸŽ€

  • tlb β€” the mmu gather. yes, that mmu gather. the lil collection bag of things-to-be-flushed 🧺
  • unmap β€” the unmap_desc. it's giving "the descriptor of what we're unmapping" and honestly? iconic πŸ‘‘

πŸ¦‹ NOTE πŸ¦‹

okay so here's the tea, and you actually need this part β˜•

pg_start and pg_end are provided to indicate the absolute range of the page tables that should be removed. and listen β€” this range can differ from the vma mappings on some archs, specifically archs that may have mappings that need to be removed outside the vmas πŸ™ˆ so don't just assume the vmas tell the whole story, bestie.

also, prev->vm_end and next->vm_start are often used. not always, but often. iykyk πŸ’…

and then there's this one: vma_end differs from pg_end when a dup_mmap failed and the tree has unrelated data to the mm_struct being torn down 😭 so if you're sitting there like "why don't these match", that's why. it's not a bug, it's the failure path, and she is messy πŸ’€


🌈 SEE ALSO 🌈

kernel file ./mm/memory.c, plus this absolutely stacked cast of characters β€” genuinely a group chat worth joining 🫢


and that's the page, bestie πŸ’– this one lives in ./mm, dated October 2026, and it's filed as free_pgtables(9) β€” go forth and free those page tables responsibly, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from