函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:hugetlb_fault

函数原型:vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags)

返回类型:vm_fault_t

参数:

类型参数名称
struct mm_struct *mm
struct vm_area_struct *vma
unsigned longaddress
unsigned intflags
4006  struct page * page = NULL
4007  struct page * pagecache_page = NULL
4008  h等于hstate_vma(vma)
4010  need_wait_lock等于0
4011  haddr等于address按位与huge_page_mask(h)
4013  ptep等于huge_pte_offset(mm, haddr, huge_page_size(h))
4014  如果ptep
4015  entry等于huge_ptep_get(ptep)
4018  返回:0
4019  否则如果此条件成立可能性小(为编译器优化)(is_hugetlb_entry_hwpoisoned(entry))则返回:VM_FAULT_HWPOISON_LARGE按位或Encode hstate index for a hwpoisoned large page (hstate_index(h))
4022  否则
4023  ptep等于arch callbacks
4024  如果非ptep则返回:VM_FAULT_OOM
4028  mapping等于f_mapping
4029  idx等于Convert the address within this vma to the page offset within* the mapping, in pagecache page units; huge pages here.
4036  hash等于For uniprocesor systems we always use a single mutex, so just* return 0 and avoid the hashing overhead.
4037  mutex_lock( & hugetlb_fault_mutex_table[hash])
4039  entry等于huge_ptep_get(ptep)
4040  如果huge_pte_none(entry)则
4041  ret等于hugetlb_no_page(mm, vma, mapping, idx, address, ptep, flags)
4042  转到:out_mutex
4045  ret等于0
4054  如果非pte_present(entry)则转到:out_mutex
4065  如果flags按位与Fault was a write access 且非huge_pte_write(entry)则
4066  如果vma_needs_reservation(h, vma, haddr)小于0则
4067  ret等于VM_FAULT_OOM
4068  转到:out_mutex
4071  vma_end_reservation(h, vma, haddr)
4073  如果非Flags, see mm.h. 按位与VM_MAYSHARE的值则pagecache_page等于Return the pagecache page at a given address within a VMA
4078  ptl等于huge_pte_lock(h, mm, ptep)
4081  如果此条件成立可能性小(为编译器优化)(!pte_same(entry, huge_ptep_get(ptep)))则转到:out_ptl
4089  page等于pte_page(entry)
4090  如果page不等于pagecache_page则如果非Return true if the page was successfully locked
4092  need_wait_lock等于1
4093  转到:out_ptl
4096  get_page(page)
4098  如果flags按位与Fault was a write access
4099  如果非huge_pte_write(entry)则
4102  转到:out_put_page
4104  entry等于huge_pte_mkdirty(entry)
4106  entry等于pte_mkyoung(entry)
4107  如果huge_ptep_set_access_flags(vma, haddr, ptep, entry, flags & Fault was a write access )则The x86 doesn't have any external MMU info: the kernel page* tables contain all the necessary information.
4110  out_put_page :
4111  如果page不等于pagecache_pagelock_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.
4113  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
4114  out_ptl :
4115  自旋锁解锁
4117  如果pagecache_page
4118  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.
4119  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
4121  out_mutex :
4122  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
4130  如果need_wait_lockWait for a page to be unlocked.* This must be called with the caller "holding" the page,* ie with increased "page->count" so that the page won't* go away during the wait..
4132  返回:ret
调用者
名称描述
follow_hugetlb_page
handle_mm_faultBy the time we get here, we already hold the mm semaphore* The mmap_sem may have been released depending on flags and our* return value. See filemap_fault() and __lock_page_or_retry().