huge_pmd_unshare(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– huge_pmd_unshare(9) πŸ’–

okay so welcome to the Kernel API Manual, bestie β€” this is the page for huge_pmd_unshare(9), and it’s literally about unmapping a pmd table if it’s shared by multiple users. slay.

✨ NAME ✨

huge_pmd_unshare β€” Unmap a pmd table if it is shared by multiple users.

🌸 SYNOPSIS 🌸

int huge_pmd_unshare (struct mmu_gather *tlb , struct vm_area_struct
*vma , unsigned long addr , pte_t *ptep );

πŸŽ€ ARGUMENTS πŸŽ€

  • tlb β€” the current mmu_gather. yes, that one.
  • vma β€” the vma covering the pmd table.
  • addr β€” the address we are trying to unshare.
  • ptep β€” pointer into the (pmd) page table. iconic pointer behavior.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the vibe check here is very specific: it’s called with the page table lock held, the i_mmap_rwsem held in write mode and the hugetlb vma lock held in write mode. no cap, all three of those are part of the setup.

πŸ“ NOTE πŸ“

⚠️ the caller must call huge_pmd_unshare_flush before dropping the i_mmap_rwsem. do not skip this step, bestie β€” it’s giving mandatory.

πŸ” RETURN πŸ”

returns 1 if it was a shared PMD table and it got unmapped, or 0 if it was not a shared PMD table. that’s the whole return moment.

πŸ‘€ SEE ALSO πŸ‘€


πŸ’– source/version ./mm, dated October 2026, page huge_pmd_unshare(9) β€” byeee bestie, go unmap responsibly 🫢

πŸ“¦ where this page comes from