函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__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

函数原型:static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, struct vm_area_struct **vmas, int *nonblocking)

返回类型:long

参数:

类型参数名称
struct task_struct *tsk
struct mm_struct *mm
unsigned longstart
unsigned longnr_pages
unsigned intgup_flags
struct page **pages
struct vm_area_struct **vmas
int *nonblocking
790  ret等于0, i等于0
791  struct vm_area_struct * vma = NULL
792  struct follow_page_context ctx = {NULL}
794  如果非nr_pages则返回:0
797  start等于Architectures that support memory tagging (assigning tags to memory regions,* embedding these tags into addresses that point to these memory regions, and* checking that the memory and the pointer tags match on memory accesses)(start)
799  VM_BUG_ON(!!pages != !!(gup_flags & do get_page on page ))
806  如果非gup_flags按位与get_user_pages read/write w/o permission 的值则gup_flags或等于rce NUMA hinting page fault
809  循环
811  foll_flags等于gup_flags
816  vma等于find_extend_vma(mm, start)
817  如果非vmain_gate_area(mm, start)则
818  ret等于get_gate_page(mm, start & PAGE_MASK, gup_flags, & vma, pages ? & pages[i] : NULL)
821  如果ret则转到:out
823  page_mask等于0
824  转到:next_page
827  如果非vmacheck_vma_flags(vma, gup_flags)则
828  ret等于负EFAULT
829  转到:out
831  如果is_vm_hugetlb_page(vma)则
835  继续下一循环
838  retry :
845  转到:out
847  cond_resched()
849  page等于llow_page_mask - look up a page descriptor from a user-virtual address*@vma: vm_area_struct mapping @address*@address: virtual address to look up*@flags: flags modifying lookup behaviour*@ctx: contains dev_pagemap for %ZONE_DEVICE memory pinning and a*
850  如果非page
854  :ret恒等于0
855  转到:retry
856  :ret恒等于负EBUSY
857  ret等于0
859  :ret恒等于负EFAULT
860  :ret恒等于负ENOMEM
861  :ret恒等于负EHWPOISON
862  转到:out
863  :ret恒等于负ENOENT
864  转到:next_page
866  BUG()
867  否则如果错误恒等于负EEXIST
872  转到:next_page
873  否则如果是错误
874  ret等于错误
875  转到:out
877  如果pages
878  pages[i]等于page
881  page_mask等于0
883  next_page :
884  如果vmas
885  vmas[i]等于vma
886  page_mask等于0
888  page_increm等于1加start右移PAGE_SHIFT determines the page size 位的值的反按位与page_mask的值
889  如果page_increm大于nr_pagespage_increm等于nr_pages
891  i加等于page_increm
892  start加等于page_incremPAGE_SIZE
893  nr_pages减等于page_increm
894 nr_pages循环
895  out :
896  如果pgmapput_dev_pagemap(pgmap)
898  返回:如果ii否则ret
调用者
名称描述
__get_user_pages_locked
populate_vma_page_rangepopulate_vma_page_range() - populate a range of pages in the vma