函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Hugetlb_cow() should be called with page lock of the original hugepage held.* Called with hugetlb_instantiation_mutex held and pte_page locked so we* cannot race with other handlers or page migration.

函数原型:static vm_fault_t hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *ptep, struct page *pagecache_page, spinlock_t *ptl)

返回类型:vm_fault_t

参数:

类型参数名称
struct mm_struct *mm
struct vm_area_struct *vma
unsigned longaddress
pte_t *ptep
struct page *pagecache_page
spinlock_t *ptl
3613  h等于hstate_vma(vma)
3615  outside_reserve等于0
3616  ret等于0
3617  haddr等于address按位与huge_page_mask(h)
3620  pte等于huge_ptep_get(ptep)
3621  old_page等于pte_page(pte)
3623  retry_avoidcopy :
3626  如果page_mapcount(old_page)恒等于1且PageAnon(old_page)则
3627  page_move_anon_rmap - move a page to our anon_vma*@page: the page to move to our anon_vma*@vma: the vma the page belongs to* When a page belongs exclusively to one process after a COW event,* that page can be moved into the anon_vma that belongs to just
3628  set_huge_ptep_writable(vma, haddr, ptep)
3629  返回:0
3641  如果is_vma_resv_set(vma, Flags for MAP_PRIVATE reservations. These are stored in the bottom* bits of the reservation map pointer, which are always clear due to* alignment.)且old_page不等于pagecache_pageoutside_reserve等于1
3645  get_page(old_page)
3651  自旋锁解锁
3652  new_page等于alloc_huge_page(vma, haddr, outside_reserve)
3654  如果是错误
3662  如果outside_reserve
3667  加自旋锁
3676  返回:0
3679  ret等于vmf_error(错误)
3680  转到:out_release_old
3687  如果此条件成立可能性小(为编译器优化)(anon_vma_prepare(vma))则
3688  ret等于VM_FAULT_OOM
3689  转到:out_release_all
3692  copy_user_huge_page(new_page, old_page, address, vma, pages_per_huge_page(h))
3694  __SetPageUptodate(new_page)
3696  mmu_notifier_range_init( & range, MMU_NOTIFY_CLEAR, 0, vma, mm, haddr, haddr + huge_page_size(h))
3698  mmu_notifier_invalidate_range_start( & range)
3704  加自旋锁
3705  ptep等于huge_pte_offset(mm, haddr, huge_page_size(h))
3706  如果此条件成立可能性大(为编译器优化)(ptep && pte_same(huge_ptep_get(ptep), pte))则
3707  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
3710  huge_ptep_clear_flush(vma, haddr, ptep)
3711  mmu_notifier_invalidate_range(mm, start, end)
3712  set_huge_pte_at(mm, haddr, ptep, make_huge_pte(vma, new_page, 1))
3714  page_remove_rmap - take down pte mapping from a page*@page: page to remove mapping from*@compound: uncharge the page as compound or small page* The caller needs to hold the pte lock.
3715  hugepage_add_new_anon_rmap(new_page, vma, haddr)
3716  ver called for tail page
3718  new_page等于old_page
3720  自旋锁解锁
3721  mmu_notifier_invalidate_range_end( & range)
3722  out_release_all :
3723  This routine is called to restore a reservation on error paths
3724  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
3725  out_release_old :
3726  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
3728  加自旋锁
3729  返回:ret
调用者
名称描述
hugetlb_no_page
hugetlb_fault