__GET_USER_PAGES - Online Linux Manual PageSection : 9
Updated : June 2018
Source : Kernel Hackers Manual 2​.6​.
Note : Memory Management in Linux

NAME__get_user_pages − pin user pages in memory

SYNOPSISint __get_user_pages(struct task_struct * tsk, struct mm_struct * mm, unsigned long start, int nr_pages, unsigned int gup_flags, struct page ** pages, struct vm_area_struct ** vmas);

ARGUMENTStsk task_struct of target task mm mm_struct of target mm start starting user address nr_pages number of pages from start to pin gup_flags flags modifying pin behaviour pages array that receives pointers to the pages pinned​. Should be at least nr_pages long​. Or NULL, if caller only intends to ensure the pages are faulted in​. vmas array of pointers to vmas corresponding to each page​. Or NULL if the caller does not require them​.

DESCRIPTIONReturns 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​. Each page returned must be released with a put_page call when it is finished with​. vmas will only remain valid while mmap_sem is held​. Must be called with mmap_sem held for read or write​. __get_user_pages walks a process´s page tables and takes a reference to each struct page that each user address corresponds to at a given instant​. That is, it takes the page that would be accessed if a user thread accesses the given user virtual address at that instant​. This does not guarantee that the page exists in the user mappings when __get_user_pages returns, and there may even be a completely different page there in some cases (eg​. if mmapped pagecache has been invalidated and subsequently re faulted)​. However it does guarantee that the page won´t be freed completely​. And mostly callers simply care that the page contains data that was valid *at some point in time*​. Typically, an IO or similar operation cannot guarantee anything stronger anyway because locks can´t be held over the syscall boundary​. If gup_flags & FOLL_WRITE == 0, the page must not be written to​. If the page is written to, set_page_dirty (or set_page_dirty_lock, as appropriate) must be called after the page is finished with, and before put_page is called​. In most cases, get_user_pages or get_user_pages_fast should be used instead of __get_user_pages​. __get_user_pages should be used only if you need some special gup_flags​.

COPYRIGHT
0
Johanes Gumabo
Data Size   :   8,316 byte
man-__get_user_pages.9Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 167,069
Visitor ID   :     :  
Visitor IP   :   18.117.11.13   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.