Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:follow_hugetlb_page

Proto: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)

Type:long

Parameter:

TypeParameterName
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  When vaddr < The first byte after our end addresswithin vm_mm. && remainder cycle
4279  spinlock_t * ptl = NULL
4288  remainder = 0
4289  Break
4299  pte = huge_pte_offset(mm, vaddr & huge_page_mask(h), huge_page_size(h))
4301  If pte Then ptl = huge_pte_lock(h, mm, pte)
4303  absent = Not pte || huge_pte_none(huge_ptep_get(pte))
4314  If pte Then spin_unlock(ptl)
4316  remainder = 0
4317  Break
4334  fault_flags = 0
4336  If pte Then spin_unlock(ptl)
4351  If ret & VM_FAULT_ERROR Then
4356  If ret & VM_FAULT_RETRY Then
4360  nr_pages = 0
4370  Return i
4372  Continue
4375  pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT determines the page size
4376  page = pte_page(huge_ptep_get(pte))
4383  If pages Then
4384  spin_unlock(ptl)
4385  remainder = 0
4386  err = -ENOMEM
4387  Break
4398  vaddr += huge_page_size(h)
4400  i += pages_per_huge_page(h)
4401  spin_unlock(ptl)
4402  Continue
4405  same_page :
4406  If pages Then
4408  get_page(pages[i])
4411  If vmas Then vmas[i] = vma
4414  vaddr += PAGE_SIZE
4415  ++pfn_offset
4416  --remainder
4417  ++i
4424  Go to same_page
4426  spin_unlock(ptl)
4428  nr_pages = remainder
4434  position = vaddr
4436  Return If i Then i Else err