Function report |
Source Code:mm\hugetlb.c |
Create Date:2022-07-28 15:29:03 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:hugetlb_fault
Proto:vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags)
Type:vm_fault_t
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct mm_struct * | mm | |
| struct vm_area_struct * | vma | |
| unsigned long | address | |
| unsigned int | flags |
| 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 | If ptep Then |
| 4022 | Else |
| 4023 | ptep = arch callbacks |
| 4024 | If Not ptep Then Return VM_FAULT_OOM |
| 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 | If huge_pte_none(entry) Then |
| 4045 | ret = 0 |
| 4054 | If Not pte_present(entry) Then Go to out_mutex |
| 4065 | If flags & Fault was a write access && Not huge_pte_write(entry) Then |
| 4066 | If vma_needs_reservation(h, vma, haddr) < 0 Then |
| 4067 | ret = VM_FAULT_OOM |
| 4068 | Go to out_mutex |
| 4071 | vma_end_reservation(h, vma, haddr) |
| 4073 | If Not (Flags, see mm.h. & VM_MAYSHARE) Then pagecache_page = Return the pagecache page at a given address within a VMA |
| 4078 | ptl = huge_pte_lock(h, mm, ptep) |
| 4081 | If Value for the false possibility is greater at compile time(!pte_same(entry, huge_ptep_get(ptep))) Then Go to out_ptl |
| 4090 | If page != pagecache_page Then If Not Return true if the page was successfully locked Then |
| 4092 | need_wait_lock = 1 |
| 4093 | Go to out_ptl |
| 4098 | If flags & Fault was a write access Then |
| 4099 | If Not huge_pte_write(entry) Then |
| 4102 | Go to out_put_page |
| 4104 | entry = huge_pte_mkdirty(entry) |
| 4106 | entry = pte_mkyoung(entry) |
| 4110 | out_put_page : |
| 4114 | out_ptl : |
| 4115 | spin_unlock(ptl) |
| 4117 | If pagecache_page Then |
| 4121 | out_mutex : |
| 4130 | If need_wait_lock Then Wait 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 | Return ret |
| Name | Describe |
|---|---|
| follow_hugetlb_page | |
| handle_mm_fault | By 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(). |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |