Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:copy_hugetlb_page_range

Proto:int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma)

Type:int

Parameter:

TypeParameterName
struct mm_struct *dst
struct mm_struct *src
struct vm_area_struct *vma
3307  h = hstate_vma(vma)
3308  sz = huge_page_size(h)
3310  ret = 0
3312  cow = (Flags, see mm.h. & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE
3314  If cow Then
3315  mmu_notifier_range_init( & range, MMU_NOTIFY_CLEAR, 0, vma, src, Our start address within vm_mm. , The first byte after our end addresswithin vm_mm. )
3318  mmu_notifier_invalidate_range_start( & range)
3321  When addr < The first byte after our end addresswithin vm_mm. cycle
3323  src_pte = huge_pte_offset(src, addr, sz)
3324  If Not src_pte Then Continue
3326  dst_pte = arch callbacks
3327  If Not dst_pte Then
3328  ret = -ENOMEM
3329  Break
3341  dst_entry = huge_ptep_get(dst_pte)
3342  If dst_pte == src_pte || Not huge_pte_none(dst_entry) Then Continue
3345  dst_ptl = huge_pte_lock(h, dst, dst_pte)
3346  src_ptl = huge_pte_lockptr(h, src, src_pte)
3347  spin_lock_nested(src_ptl, For trivial one-depth nesting of a lock-class, the following* global define can be used. (Subsystems with multiple levels* of nesting should define their own lock-nesting subclasses.))
3348  entry = huge_ptep_get(src_pte)
3349  dst_entry = huge_ptep_get(dst_pte)
3350  If huge_pte_none(entry) || Not huge_pte_none(dst_entry) Then Else if Value for the false possibility is greater at compile time(is_hugetlb_entry_migration(entry) || is_hugetlb_entry_hwpoisoned(entry)) Then
3359  swp_entry = Convert the arch-dependent pte representation of a swp_entry_t into an* arch-independent swp_entry_t.
3371  set_huge_swap_pte_at(dst, addr, dst_pte, entry, sz)
3372  Else
3373  If cow Then
3383  entry = huge_ptep_get(src_pte)
3384  ptepage = pte_page(entry)
3385  get_page(ptepage)
3386  page_dup_rmap(ptepage, true)
3387  set_huge_pte_at(dst, addr, dst_pte, entry)
3388  hugetlb_count_add(pages_per_huge_page(h), dst)
3390  spin_unlock(src_ptl)
3391  spin_unlock(dst_ptl)
3394  If cow Then mmu_notifier_invalidate_range_end( & range)
3397  Return ret