get_user_pages_fast — pin user pages in memory
intget_user_pages_fast( | unsigned longstart, |
| intnr_pages, | |
| intwrite, | |
struct page **pages); |
unsigned long startstarting user address
int nr_pagesnumber of pages from start to pin
int writewhether pages will be written to
struct page ** pagesarray that receives pointers to the pages pinned. Should be at least nr_pages long.
Returns number of pages pinned. This may be fewer than the number requested. If nr_pages is 0 or negative, returns 0. If no pages were pinned, returns -errno.
get_user_pages_fast provides equivalent functionality to get_user_pages, operating on current and current->mm, with force=0 and vma=NULL. However unlike get_user_pages, it must be called without mmap_sem held.
get_user_pages_fast may take mmap_sem and page table locks, so no assumptions can be made about lack of locking. get_user_pages_fast is to be implemented in a way that is advantageous (vsget_user_pages) when the user memory area is already faulted in and present in ptes. However if the pages have to be faulted in, it may turn out to be slightly slower so callers need to carefully consider what to use. On many architectures, get_user_pages_fast simply falls back to get_user_pages.