| Function report | 
| Source Code: kernel\fork.c | Create Date:2022-07-28 08:57:43 | 
| Last Modify:2020-03-17 11:04:53 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:dup_mmap
Proto:static __latent_entropy int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct mm_struct * | mm | |
| struct mm_struct * | oldmm | 
| 490 | uprobe_start_dup_mmap() | 
| 491 | If down_write_killable( & mmap_sem) Then | 
| 493 | Go to fail_uprobe_end | 
| 495 | flush_cache_dup_mm(oldmm) | 
| 496 | uprobe_dup_mmap(oldmm, mm) | 
| 511 | rb_parent = NULL | 
| 512 | pprev = list of VMAs | 
| 516 | retval = khugepaged_fork(mm, oldmm) | 
| 520 | prev = NULL | 
| 524 | If Flags, see mm.h. & Do not copy this vma on fork Then | 
| 525 | vm_stat_account(mm, Flags, see mm.h. , - vma_pages(mpnt)) | 
| 526 | Continue | 
| 528 | charge = 0 | 
| 533 | If fatal_signal_pending(current process) Then | 
| 537 | If Flags, see mm.h. & Is a VM accounted object Then | 
| 540 | If security_vm_enough_memory_mm(oldmm, len) Then Go to fail_nomem | 
| 544 | tmp = vm_area_dup(mpnt) | 
| 545 | If Not tmp Then Go to fail_nomem | 
| 547 | retval = vma_dup_policy(mpnt, tmp) | 
| 548 | If retval Then Go to fail_nomem_policy | 
| 551 | retval = dup_userfaultfd(tmp, & uf) | 
| 552 | If retval Then Go to fail_nomem_anon_vma_fork | 
| 554 | If Flags, see mm.h. & Wipe VMA contents in child. Then | 
| 556 | Serialized by page_table_lock = NULL | 
| 557 | If anon_vma_prepare(tmp) Then Go to fail_nomem_anon_vma_fork | 
| 562 | linked list of VM areas per task, sorted by address = linked list of VM areas per task, sorted by address = NULL | 
| 564 | If file Then | 
| 565 | inode = file_inode(file) | 
| 569 | If Flags, see mm.h. & ETXTBSY on write attempts.. Then atomic_dec( & i_writecount) | 
| 571 | i_mmap_lock_write(mapping) | 
| 572 | If Flags, see mm.h. & VM_SHARED Then atomic_inc( & i_mmap_writable) | 
| 576 | vma_interval_tree_insert_after(tmp, mpnt, & i_mmap) | 
| 587 | If is_vm_hugetlb_page(tmp) Then reset_vma_resv_huge_pages(tmp) | 
| 598 | __vma_link_rb(mm, tmp, rb_link, rb_parent) | 
| 602 | number of VMAs ++ | 
| 603 | If Not (Flags, see mm.h. & Wipe VMA contents in child. ) Then retval = copy_page_range(mm, oldmm, mpnt) | 
| 606 | If Function pointers to deal with this struct. && open Then open(tmp) | 
| 613 | retval = arch_dup_mmap(oldmm, mm) | 
| 614 | out : | 
| 616 | flush_tlb_mm(oldmm) | 
| 618 | dup_userfaultfd_complete( & uf) | 
| 619 | fail_uprobe_end : | 
| 620 | uprobe_end_dup_mmap() | 
| 621 | Return retval | 
| 622 | fail_nomem_anon_vma_fork : | 
| 623 | mpol_put(vma_policy(tmp)) | 
| 624 | fail_nomem_policy : | 
| 625 | vm_area_free(tmp) | 
| 626 | fail_nomem : | 
| 628 | vm_unacct_memory(charge) | 
| 629 | Go to out | 
| Name | Describe | 
|---|---|
| dup_mm | dup_mm() - duplicates an existing mm structure*@tsk: the task_struct with which the new mm will be associated.*@oldmm: the mm to duplicate.* Allocates a new mm structure and duplicates the provided @oldmm structure* content into it. | 
| 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 |