hmm_range_fault(9)
π hmm_range_fault(9) π
okay so bestie, welcome to the Kernel API Manual β this one's a section 9 situation, which means it's kernel-internals territory. and honestly? she's kind of a big deal. let's get into it π«Ά
β¨ NAME β¨
hmm_range_fault β the girl whose whole job is to try to fault some address in a virtual address range. that's it, that's the mission. π―
πΈ SYNOPSIS πΈ
int hmm_range_fault (struct hmm_range *range );
literally one function, one argument. minimalism. she ate. π
π ARGUMENTS π
rangeβ the argument structure. yeah that's the whole description bestie, the manpage said it and i'm not gonna invent lore π it's just your hmm_range struct.
π DESCRIPTION π
so what does she return? 0 on success β¨ β or one of these error codes, and you will be reading them:
-EINVALβ invalid arguments, or themmor virtual address is sitting in an invalid vma (e.g., a device file vma). nope, not that one, try again π-ENOMEMβ out of memory. the classic. the icon. the reason we can't have nice things π-EPERMβ invalid permission (e.g., you're asking for write and the range is read only). bold of you to ask, honestly π-EBUSYβ the range has been invalidated, so the caller needs to wait for the invalidation to finish. hold on hold on hold on π«-EFAULTβ a page was requested to be valid and could not be made valid, ie it has no backing VMA or it is illegal to access. the audacity π¨
ngl, she's similar to get_user_pages, except β and this is the slay part β she can read the page tables without mutating them (ie causing faults). no cap, she's just looking respectfully πβ¨
now the part where you need to pay attention, bestie:
the mmap lock must be held by the caller and will remain held on return. do not fumble this. π
new users should prefer hmm_range_fault_unlocked_timeout unless they specifically need to keep the mmap lock held across the call. like, genuinely specifically. π«Ά
and one more thing β this helper cannot support VMAs whose fault handlers need to drop the mmap lock. that's not a vibe thing, that's a hard limitation, so don't come for her when it doesn't work π
π¦ SEE ALSO π¦
go read these too, i'm obsessed with a cross-referenced manpage:
- Kernel file
./mm/hmm.c hmm_range_fault_unlocked_timeout(9)hmm_dma_map_alloc(9)hmm_dma_map_free(9)hmm_dma_map_pfn(9)hmm_dma_unmap_pfn(9)
and that's the whole page, bestie β no notes, she's perfect π β¨
signing off from ./mm, dated October 2026 β catch you in the next manpage, muah πππ¦
π¦ 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