get_user_pages_fast(9)
π 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 fromstartto 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 leastnr_pageslong β 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:
try_grab_folio(9)unpin_user_page(9)unpin_folio(9)folio_add_pin(9)unpin_user_pages_dirty_lock(9)unpin_user_page_range_dirty_lock(9)unpin_user_pages(9)unpin_user_folio(9)unpin_folios(9)try_grab_folio_fast(9)follow_page_mask(9)__get_user_pages(9)fixup_user_fault(9)populate_vma_page_range(9)fault_in_writeable(9)fault_in_subpage_writeable(9)fault_in_readable(9)get_dump_page(9)get_user_pages_remote(9)get_user_pages(9)get_user_pages_fast_only(9)pin_user_pages_fast(9)pin_user_pages_remote(9)pin_user_pages(9)memfd_pin_folios(9)folio_add_pins(9)
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
- 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