hmm_range_fault(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the mm or 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:


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