Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\gup.c Create Date:2022-07-28 14:35:12
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__get_user_pages_locked

Proto:static __always_inline long __get_user_pages_locked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, struct page **pages, struct vm_area_struct **vmas, int *locked, unsigned int flags)

Type:long

Parameter:

TypeParameterName
struct task_struct *tsk
struct mm_struct *mm
unsigned longstart
unsigned longnr_pages
struct page **pages
struct vm_area_struct **vmas
int *locked
unsigned intflags
1016  If locked Then
1018  BUG_ON(vmas)
1020  BUG_ON( * locked != 1)
1023  If pages Then flags |= do get_page on page
1026  pages_done = 0
1027  lock_dropped = false
1028  cycle
1029  ret = __get_user_pages() - pin user pages in memory*@tsk: 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
1031  If Not locked Then Return ret
1036  If Not locked Then
1037  BUG_ON(ret < 0)
1038  BUG_ON(ret >= nr_pages)
1041  If ret > 0 Then
1042  nr_pages -= ret
1043  pages_done += ret
1044  If Not nr_pages Then Break
1047  If locked Then
1052  If Not pages_done Then pages_done = ret
1054  Break
1060  If Value is more likely to compile time(pages) Then pages += ret
1062  start += ret << PAGE_SHIFT determines the page size
1069  locked = 1
1070  lock_dropped = true
1071  lock for reading
1072  ret = __get_user_pages() - pin user pages in memory*@tsk: 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
1074  If ret != 1 Then
1075  BUG_ON(ret > 1)
1076  If Not pages_done Then pages_done = ret
1078  Break
1080  nr_pages--
1081  pages_done++
1082  If Not nr_pages Then Break
1084  If Value is more likely to compile time(pages) Then pages++
1086  start += PAGE_SIZE
1088  If lock_dropped && locked Then
1093  lease a read lock
1094  locked = 0
1096  Return pages_done
Caller
NameDescribe
get_user_pages_remoteget_user_pages_remote() - pin user pages in memory*@tsk: the task_struct to use for page fault accounting, or* NULL if faults are not to be recorded
check_and_migrate_cma_pages
__gup_longterm_locked__gup_longterm_locked() is a wrapper for __get_user_pages_locked which* allows us to process the FOLL_LONGTERM flag.
get_user_pages_lockedWe can leverage the VM_FAULT_RETRY functionality in the page fault* paths better by using either get_user_pages_locked() or* get_user_pages_unlocked().* get_user_pages_locked() is suitable to replace the form:* down_read(&mm->mmap_sem);* do_something()
get_user_pages_unlockedget_user_pages_unlocked() is suitable to replace the form:* down_read(&mm->mmap_sem);* get_user_pages(tsk, mm,