函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:follow_hugetlb_page

函数原型:long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, struct page **pages, struct vm_area_struct **vmas, unsigned long *position, unsigned long *nr_pages, long i, unsigned int flags, int *nonblocking)

返回类型:long

参数:

类型参数名称
struct mm_struct *mm
struct vm_area_struct *vma
struct page **pages
struct vm_area_struct **vmas
unsigned long *position
unsigned long *nr_pages
longi
unsigned intflags
int *nonblocking
4272  vaddr等于position
4273  remainder等于nr_pages
4274  h等于hstate_vma(vma)
4275  err等于负EFAULT
4277 vaddr小于The first byte after our end addresswithin vm_mm. remainder循环
4279  spinlock_t * ptl = NULL
4288  remainder等于0
4289  退出
4299  pte等于huge_pte_offset(mm, vaddr & huge_page_mask(h), huge_page_size(h))
4301  如果pteptl等于huge_pte_lock(h, mm, pte)
4303  absent等于非ptehuge_pte_none(huge_ptep_get(pte))
4314  如果pte自旋锁解锁
4316  remainder等于0
4317  退出
4334  fault_flags等于0
4336  如果pte自旋锁解锁
4351  如果ret按位与VM_FAULT_ERROR
4356  如果ret按位与VM_FAULT_RETRY
4360  nr_pages等于0
4370  返回:i
4372  继续下一循环
4375  pfn_offset等于vaddr按位与huge_page_mask(h)的反的值右移PAGE_SHIFT determines the page size
4376  page等于pte_page(huge_ptep_get(pte))
4383  如果pages
4385  remainder等于0
4386  err等于负ENOMEM
4387  退出
4398  vaddr加等于huge_page_size(h)
4399  remainder减等于pages_per_huge_page(h)
4400  i加等于pages_per_huge_page(h)
4402  继续下一循环
4405  same_page :
4406  如果pages
4408  get_page(pages[i])
4411  如果vmasvmas[i]等于vma
4414  vaddr加等于PAGE_SIZE
4415  pfn_offset先自加
4416  remainder先自减
4417  i先自加
4424  转到:same_page
4426  自旋锁解锁
4428  nr_pages等于remainder
4434  position等于vaddr
4436  返回:如果ii否则err
调用者
名称描述
__get_user_pages__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