函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Used by userfaultfd UFFDIO_COPY. Based on mcopy_atomic_pte with* modifications for huge pages.

函数原型:int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr, struct page **pagep)

返回类型:int

参数:

类型参数名称
struct mm_struct *dst_mm
pte_t *dst_pte
struct vm_area_struct *dst_vma
unsigned longdst_addr
unsigned longsrc_addr
struct page **pagep
4149  vm_shared等于Flags, see mm.h. 按位与VM_SHARED
4150  h等于hstate_vma(dst_vma)
4156  如果非pagep
4157  ret等于负ENOMEM
4158  page等于alloc_huge_page(dst_vma, dst_addr, 0)
4159  如果是错误则转到:out
4162  ret等于copy_huge_page_from_user(page, (constvoid__user * )src_addr, pages_per_huge_page(h), false)
4168  ret等于负ENOENT
4169  pagep等于page
4171  转到:out
4173  否则
4174  page等于pagep
4175  * pagep = NULL
4183  __SetPageUptodate(page)
4185  mapping等于f_mapping
4186  idx等于Convert the address within this vma to the page offset within* the mapping, in pagecache page units; huge pages here.
4191  如果vm_shared
4192  size等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they 右移huge_page_shift(h)位
4193  ret等于负EFAULT
4194  如果idx大于等于size则转到:out_release_nounlock
4203  ret等于huge_add_to_page_cache(page, mapping, idx)
4204  如果ret则转到:out_release_nounlock
4208  ptl等于huge_pte_lockptr(h, dst_mm, dst_pte)
4209  加自旋锁
4220  size等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they 右移huge_page_shift(h)位
4221  ret等于负EFAULT
4222  如果idx大于等于size则转到:out_release_unlock
4225  ret等于负EEXIST
4226  如果非huge_pte_none(huge_ptep_get(dst_pte))则转到:out_release_unlock
4229  如果vm_shared
4230  page_dup_rmap(page, true)
4231  否则
4232  Private page markings that may be used by the filesystem that owns the page* for its own purposes.* - PG_private and PG_private_2 cause releasepage() and co to be invoked
4233  hugepage_add_new_anon_rmap(page, dst_vma, dst_addr)
4236  _dst_pte等于make_huge_pte(dst_vma, page, Flags, see mm.h. & VM_WRITE)
4237  如果Flags, see mm.h. 按位与VM_WRITE_dst_pte等于huge_pte_mkdirty(_dst_pte)
4239  _dst_pte等于pte_mkyoung(_dst_pte)
4241  set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte)
4243  huge_ptep_set_access_flags(dst_vma, dst_addr, dst_pte, _dst_pte, Flags, see mm.h. & VM_WRITE)
4245  hugetlb_count_add(pages_per_huge_page(h), dst_mm)
4248  The x86 doesn't have any external MMU info: the kernel page* tables contain all the necessary information.
4250  自旋锁解锁
4251  ver called for tail page
4252  如果vm_sharedlock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
4254  ret等于0
4255  out :
4256  返回:ret
4257  out_release_unlock :
4258  自旋锁解锁
4259  如果vm_sharedlock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
4261  out_release_nounlock :
4262  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
4263  转到:out
调用者
名称描述
__mcopy_atomic_hugetlb__mcopy_atomic processing for HUGETLB vmas. Note that this routine is* called with mmap_sem held, it will release mmap_sem before returning.