Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mmap_sem must be held on entry. If @nonblocking != NULL and* *@flags does not include FOLL_NOWAIT, the mmap_sem may be released.* If it is, *@nonblocking will be set to 0 and -EBUSY returned.

Proto:static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, unsigned long address, unsigned int *flags, int *nonblocking)

Type:int

Parameter:

TypeParameterName
struct task_struct *tsk
struct vm_area_struct *vma
unsigned longaddress
unsigned int *flags
int *nonblocking
621  fault_flags = 0
625  If (flags & (ault in page | lock present pages )) == lock present pages Then Return -ENOENT
627  If flags & check pte is writable Then fault_flags |= Fault was a write access
629  If flags & we are working on non-current tsk/mm Then fault_flags |= aulting for non current tsk/mm
631  If nonblocking Then fault_flags |= Retry fault if blocking
633  If flags & a disk transfer is needed, start the IO* and return without waiting upon it Then fault_flags |= Retry fault if blocking | Don't drop mmap_sem and wait when retrying
635  If flags & a retry, previous pass started an IO Then
636  VM_WARN_ON_ONCE(fault_flags & Retry fault if blocking )
637  fault_flags |= Second try
640  ret = handle_mm_fault(vma, address, fault_flags)
641  If ret & VM_FAULT_ERROR Then
642  err = NOTE on FOLL_LONGTERM:* FOLL_LONGTERM indicates that the page will be held for an indefinite time* period _often_ under userspace control
644  If err Then Return err
646  BUG()
649  If tsk Then
650  If ret & VM_FAULT_MAJOR Then maj_flt++
652  Else min_flt++
656  If ret & VM_FAULT_RETRY Then
657  If nonblocking && Not (fault_flags & Don't drop mmap_sem and wait when retrying ) Then nonblocking = 0
659  Return -EBUSY
671  If ret & VM_FAULT_WRITE && Not (Flags, see mm.h. & VM_WRITE) Then flags |= rnal GUP flag
673  Return 0
Caller
NameDescribe
__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