Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:get_vaddr_frames() - map virtual addresses to pfns*@start: starting user address*@nr_frames: number of pages / pfns from start to map*@gup_flags: flags modifying lookup behaviour*@vec: structure which receives pages / pfns of the addresses mapped.

Proto:int get_vaddr_frames(unsigned long start, unsigned int nr_frames, unsigned int gup_flags, struct frame_vector *vec)

Type:int

Parameter:

TypeParameterName
unsigned longstart
unsigned intnr_frames
unsigned intgup_flags
struct frame_vector *vec
37  mm = mm
39  ret = 0
43  If nr_frames == 0 Then Return 0
46  If WARN_ON_ONCE(nr_frames > Number of frames we have space for ) Then nr_frames = Number of frames we have space for
49  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)
51  lock for reading
52  locked = 1
53  vma = Look up the first VMA which intersects the interval start_addr..end_addr-1,NULL if none. Assume start_addr < end_addr.
54  If Not vma Then
55  ret = -EFAULT
56  Go to out
67  If vma_is_fsdax(vma) Then
68  ret = -EOPNOTSUPP
69  Go to out
72  If Not (Flags, see mm.h. & (Memory mapped I/O or similar | Page-ranges managed without "struct page", just pure PFN )) Then
73  Did we pin pages by getting page ref? = true
74  Does array contain pages or pfns? = false
75  ret = We 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()
77  Go to out
80  Did we pin pages by getting page ref? = false
81  Does array contain pages or pfns? = true
82  Do
83  nums = frame_vector_pfns(vec)
87  If err Then
88  If ret == 0 Then ret = err
90  Go to out
92  start += PAGE_SIZE
93  ret++
99  If ret >= nr_frames || start < The first byte after our end addresswithin vm_mm. Then Break
101  vma = Look up the first VMA which intersects the interval start_addr..end_addr-1,NULL if none. Assume start_addr < end_addr.
102  When vma && Flags, see mm.h. & (Memory mapped I/O or similar | Page-ranges managed without "struct page", just pure PFN ) cycle
103  out :
104  If locked Then lease a read lock
106  If Not ret Then ret = -EFAULT
108  If ret > 0 Then Number of frames stored in ptrs array = ret
110  Return ret