函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:hugetlb_no_page

函数原型:static vm_fault_t hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, struct address_space *mapping, unsigned long idx, unsigned long address, pte_t *ptep, unsigned int flags)

返回类型:vm_fault_t

参数:

类型参数名称
struct mm_struct *mm
struct vm_area_struct *vma
struct address_space *mapping
unsigned longidx
unsigned longaddress
pte_t *ptep
unsigned intflags
3793  h等于hstate_vma(vma)
3794  ret等于VM_FAULT_SIGBUS
3795  anon_rmap等于0
3800  haddr等于address按位与huge_page_mask(h)
3801  bool new_page = false
3808  如果is_vma_resv_set(vma, HPAGE_RESV_UNMAPPED)则
3809  pr_warn_ratelimited("PID %d killed due to inadequate hugepage pool\n", pid)
3811  返回:ret
3818  retry :
3819  page等于d_lock_page - locate, pin and lock a pagecache page*@mapping: the address_space to search*@offset: the page index* Looks up the page cache slot at @mapping & @offset. If there is a* page cache page, it is returned locked and with an increased* refcount.
3820  如果非page
3821  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)位
3822  如果idx大于等于size则转到:out
3828  如果userfaultfd_missing(vma)则
3852  转到:out
3855  page等于alloc_huge_page(vma, haddr, 0)
3856  如果是错误
3869  ptl等于huge_pte_lock(h, mm, ptep)
3870  如果非huge_pte_none(huge_ptep_get(ptep))则
3871  ret等于0
3873  转到:out
3876  ret等于vmf_error(错误)
3877  转到:out
3879  clear_huge_page(page, address, pages_per_huge_page(h))
3880  __SetPageUptodate(page)
3881  new_page = true
3883  如果Flags, see mm.h. 按位与VM_MAYSHARE
3885  如果err
3891  否则
3894  ret等于VM_FAULT_OOM
3895  转到:backout_unlocked
3897  anon_rmap等于1
3899  否则
3908  转到:backout_unlocked
3918  如果flags按位与Fault was a write access 且非Flags, see mm.h. 按位与VM_SHARED的值则
3919  如果vma_needs_reservation(h, vma, haddr)小于0则
3920  ret等于VM_FAULT_OOM
3921  转到:backout_unlocked
3924  vma_end_reservation(h, vma, haddr)
3927  ptl等于huge_pte_lock(h, mm, ptep)
3928  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)位
3929  如果idx大于等于size则转到:backout
3932  ret等于0
3933  如果非huge_pte_none(huge_ptep_get(ptep))则转到:backout
3936  如果anon_rmap
3937  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
3938  hugepage_add_new_anon_rmap(page, vma, haddr)
3939  否则page_dup_rmap(page, true)
3941  new_pte等于make_huge_pte(vma, page, ((Flags, see mm.h. & VM_WRITE) && (Flags, see mm.h. & VM_SHARED)))
3943  set_huge_pte_at(mm, haddr, ptep, new_pte)
3945  hugetlb_count_add(pages_per_huge_page(h), mm)
3946  如果flags按位与Fault was a write access 且非Flags, see mm.h. 按位与VM_SHARED的值则
3948  ret等于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.
3951  自旋锁解锁
3958  如果new_pagever called for tail page
3961  lock_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.
3962  out :
3963  返回:ret
3965  backout :
3966  自旋锁解锁
3967  backout_unlocked :
3968  lock_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.
3969  This routine is called to restore a reservation on error paths
3970  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
3971  转到:out
调用者
名称描述
hugetlb_fault