函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\gup.c Create Date:2022-07-27 16:01:06
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__get_user_pages_locked

函数原型: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)

返回类型:long

参数:

类型参数名称
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  如果locked
1018  BUG_ON(vmas)
1020  BUG_ON( * locked != 1)
1023  如果pagesflags或等于do get_page on page
1026  pages_done等于0
1027  lock_dropped = false
1028  循环
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  如果非locked则返回:ret
1036  如果非locked
1037  BUG_ON(ret < 0)
1038  BUG_ON(ret >= nr_pages)
1041  如果ret大于0则
1042  nr_pages减等于ret
1043  pages_done加等于ret
1044  如果非nr_pages退出
1047  如果locked
1052  如果非pages_donepages_done等于ret
1054  退出
1060  如果此条件成立可能性大(为编译器优化)(pages)则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  如果ret不等于1则
1075  BUG_ON(ret > 1)
1076  如果非pages_donepages_done等于ret
1078  退出
1080  nr_pages自减
1081  pages_done自加
1082  如果非nr_pages退出
1084  如果此条件成立可能性大(为编译器优化)(pages)则pages自加
1086  start加等于PAGE_SIZE
1088  如果lock_droppedlocked
1093  lease a read lock
1094  locked等于0
1096  返回:pages_done
调用者
名称描述
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,