pin_user_pages_remote(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– pin_user_pages_remote β€” like, the kernel manual page, bestie πŸ’–

okay so real talk, this one lives in the Kernel API Manual section (section 9, kernel devs only, iykyk) and it's literally about pinning down pages of a remote process. no cap. let's get into it 🫢


✨ NAME ✨

pin_user_pages_remote β€” pin pages of a remote process 🌸


πŸŽ€ SYNOPSIS πŸŽ€

long pin_user_pages_remote (struct mm_struct *mm , unsigned long start ,
       unsigned long nr_pages , unsigned int gup_flags , struct page **pages ,
       int *locked );

like, that's the whole vibe. six args, all business πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mm β€” the mm_struct of the target mm. this is the process whose pages you're about to be obsessed with ✨
  • start β€” starting user address. where the whole thing kicks off, fr.
  • nr_pages β€” number of pages from start to pin. counting starts now bestie πŸ”₯
  • gup_flags β€” flags that modify lookup behaviour. the lil knobs and dials πŸŽ›οΈ
  • pages β€” the array that receives pointers to the pages pinned. should be at least nr_pages long. at least, so don't come in short, it's giving underprepared 😭
  • locked β€” pointer to the lock flag, indicating whether the lock is held and subsequently whether VM_FAULT_RETRY functionality can be utilised. the lock must initially be held. main character constraint, periodt πŸ‘‘

⭐ DESCRIPTION ⭐

Nearly the same as get_user_pages_remote, except that FOLL_PIN is set. that's the whole plot twist ✨ go read get_user_pages_remote for the documentation on the function arguments, because the arguments here are identical. same energy, different function, iykyk.

FOLL_PIN means the pages must be released via unpin_user_page. no leaving them pinned and ghosting them, that's so toxic πŸ’€ please see Documentation/core-api/pin_user_pages.rst for details β€” it's all in there, go read it, it ate πŸ’–

note that if a zero_page is amongst the returned pages, it will not have pins in it, and unpin_user_page*() will not remove pins from it. so like... don't go unpinning what was never pinned, bestie πŸ™ˆ

🌈 SEE ALSO 🌈

kernel file ./mm/gup.c β€” and honestly the whole extended friend group:


and that's the whole page, bestie, no crumbs left πŸ’…

this absolute icon comes from ./mm in the Kernel API Manual, dated October 2026 β€” so like, freshly stamped, go forth and pin responsibly πŸ§šβ€β™€οΈπŸ’œβœ¨

πŸ“¦ where this page comes from