get_user_pages_fast(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, this is get_user_pages_fast(9) from the Kernel API Manual β€” the function that pins user pages in memory, and it’s giving fast-path-first energy with a locky backup plan. πŸ¦‹βœ¨

πŸ¦‹ SYNOPSIS πŸ¦‹

int get_user_pages_fast (unsigned long start , int nr_pages , unsigned
       int gup_flags , struct page **pages );

✨ ARGUMENTS ✨

  • start β€” the starting user address, aka where the page-pinning adventure begins.
  • nr_pages β€” number of pages from start to pin; think β€œhow many pages are we grabbing, bestie?”
  • gup_flags β€” flags modifying pin behaviour, so they change how the pinning goes down.
  • pages β€” array that receives pointers to the pages pinned. It should be at least nr_pages long β€” no skimping. πŸ’…

πŸŽ€ DESCRIPTION πŸŽ€

So the function attempts to pin user pages in memory without taking mm->mmap_lock. That’s the fast part, iykyk. πŸ”₯

If that’s not successful, it falls back to taking the lock and calling get_user_pages. Lowkey reliable, highkey the backup plan. 😭

It returns number of pages pinned. Heads up though: this may be fewer than the number requested. If nr_pages is 0 or negative, it returns 0. If no pages were pinned, it returns -errno. Periodt. πŸ‘‘

🌸 SEE ALSO 🌸

Kernel file ./mm/gup.c is over here doing its thing, and the full bestie list is:


Big cute sign-off energy: source ./mm, date October 2026, and the get_user_pages_fast(9) manual page itself β€” slay πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from