Function report |
Source Code:mm\hugetlb.c |
Create Date:2022-07-28 15:29:22 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:follow_hugetlb_page
Proto:long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, struct page **pages, struct vm_area_struct **vmas, unsigned long *position, unsigned long *nr_pages, long i, unsigned int flags, int *nonblocking)
Type:long
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct mm_struct * | mm | |
| struct vm_area_struct * | vma | |
| struct page ** | pages | |
| struct vm_area_struct ** | vmas | |
| unsigned long * | position | |
| unsigned long * | nr_pages | |
| long | i | |
| unsigned int | flags | |
| int * | nonblocking |
| 4274 | h = hstate_vma(vma) |
| 4277 | When vaddr < The first byte after our end addresswithin vm_mm. && remainder cycle |
| 4279 | spinlock_t * ptl = NULL |
| 4287 | If fatal_signal_pending(current process) Then |
| 4288 | remainder = 0 |
| 4289 | Break |
| 4299 | pte = huge_pte_offset(mm, vaddr & huge_page_mask(h), huge_page_size(h)) |
| 4303 | absent = Not pte || huge_pte_none(huge_ptep_get(pte)) |
| 4330 | If absent || heck whether a pte points to a swap entry || flags & check pte is writable && Not huge_pte_write(huge_ptep_get(pte)) Then |
| 4334 | fault_flags = 0 |
| 4336 | If pte Then spin_unlock(ptl) |
| 4338 | If flags & check pte is writable Then fault_flags |= Fault was a write access |
| 4340 | If nonblocking Then fault_flags |= Retry fault if blocking |
| 4342 | If flags & a disk transfer is needed, start the IO* and return without waiting upon it Then fault_flags |= Retry fault if blocking | Don't drop mmap_sem and wait when retrying |
| 4345 | If flags & a retry, previous pass started an IO Then |
| 4348 | fault_flags |= Second try |
| 4350 | ret = hugetlb_fault(mm, vma, vaddr, fault_flags) |
| 4351 | If ret & VM_FAULT_ERROR Then |
| 4352 | err = NOTE on FOLL_LONGTERM:* FOLL_LONGTERM indicates that the page will be held for an indefinite time* period _often_ under userspace control |
| 4353 | remainder = 0 |
| 4354 | Break |
| 4356 | If ret & VM_FAULT_RETRY Then |
| 4357 | If nonblocking && Not (fault_flags & Don't drop mmap_sem and wait when retrying ) Then nonblocking = 0 |
| 4360 | nr_pages = 0 |
| 4370 | Return i |
| 4372 | Continue |
| 4375 | pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT determines the page size |
| 4376 | page = pte_page(huge_ptep_get(pte)) |
| 4382 | If Value for the false possibility is greater at compile time(page_count(page) <= 0) Then |
| 4395 | If Not pages && Not vmas && Not pfn_offset && vaddr + huge_page_size(h) < The first byte after our end addresswithin vm_mm. && remainder >= pages_per_huge_page(h) Then |
| 4398 | vaddr += huge_page_size(h) |
| 4399 | remainder -= pages_per_huge_page(h) |
| 4400 | i += pages_per_huge_page(h) |
| 4401 | spin_unlock(ptl) |
| 4402 | Continue |
| 4405 | same_page : |
| 4406 | If pages Then |
| 4415 | ++pfn_offset |
| 4416 | --remainder |
| 4417 | ++i |
| 4418 | If vaddr < The first byte after our end addresswithin vm_mm. && remainder && pfn_offset < pages_per_huge_page(h) Then |
| 4424 | Go to same_page |
| 4426 | spin_unlock(ptl) |
| 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 |