huge_pmd_unshare(9)
π 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 currentmmu_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 callhuge_pmd_unshare_flushbefore dropping thei_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 π
- Kernel file
./mm/hugetlb.c hugetlb_alloc_folio(9)folio_isolate_hugetlb(9)folio_putback_hugetlb(9)
π source/version ./mm, dated October 2026, page huge_pmd_unshare(9) β byeee bestie, go unmap 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