Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:copy_huge_pmd

Proto:int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, struct vm_area_struct *vma)

Type:int

Parameter:

TypeParameterName
struct mm_struct *dst_mm
struct mm_struct *src_mm
pmd_t *dst_pmd
pmd_t *src_pmd
unsigned longaddr
struct vm_area_struct *vma
985  pgtable_t pgtable = NULL
986  ret = -ENOMEM
989  If Not vma_is_anonymous(vma) Then Return 0
992  pgtable = pte_alloc_one(dst_mm)
993  If Value for the false possibility is greater at compile time(!pgtable) Then Go to out
996  dst_ptl = pmd_lock(dst_mm, dst_pmd)
997  src_ptl = pmd_lockptr(src_mm, src_pmd)
998  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.))
1000  ret = -EAGAIN
1001  pmd = src_pmd
1024  If Value for the false possibility is greater at compile time(!pmd_trans_huge(pmd)) Then
1025  pte_free - free PTE-level user page table page*@mm: the mm_struct of the current context*@pte_page: the `struct page` representing the page table
1026  Go to out_unlock
1033  If is_huge_zero_pmd(pmd) Then
1040  zero_page = mm_get_huge_zero_page(dst_mm)
1041  Caller must hold page table lock.
1043  ret = 0
1044  Go to out_unlock
1047  src_page = Currently stuck as a macro due to indirect forward reference to* linux/mmzone.h's __section_mem_map_addr() definition:(pmd)
1048  VM_BUG_ON_PAGE(!PageHead(src_page), src_page)
1049  get_page(src_page)
1050  page_dup_rmap(src_page, true)
1051  add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR)
1052  mm_inc_nr_ptes(dst_mm)
1053  pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable)
1055  pmdp_set_wrprotect(src_mm, addr, src_pmd)
1056  pmd = pmd_mkold(pmd_wrprotect(pmd))
1057  set_pmd_at(dst_mm, addr, dst_pmd, pmd)
1059  ret = 0
1060  out_unlock :
1061  spin_unlock(src_ptl)
1062  spin_unlock(dst_ptl)
1063  out :
1064  Return ret