函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\fork.c Create Date:2022-07-27 09:57:12
Last Modify:2020-03-17 11:04:53 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:dup_mmap

函数原型:static __latent_entropy int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)

返回类型:int

参数:

类型参数名称
struct mm_struct *mm
struct mm_struct *oldmm
488  LIST_HEAD(uf)
490  uprobe_start_dup_mmap()
491  如果down_write_killable( & mmap_sem)则
492  retval等于负EINTR
493  转到:fail_uprobe_end
495  flush_cache_dup_mm(oldmm)
496  uprobe_dup_mmap(oldmm, mm)
500  down_write_nested( & mmap_sem, For trivial one-depth nesting of a lock-class, the following* global define can be used. (Subsystems with multiple levels* of nesting should define their own lock-nesting subclasses.))
503  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers( store ref to file /proc//exe symlink points to , get_mm_exe_file - acquire a reference to the mm's executable file* Returns %NULL if mm has no associated executable file.* User must release file via fput().)
505  Total pages mapped 等于 Total pages mapped
506  VM_WRITE & ~VM_SHARED & ~VM_STACK 等于 VM_WRITE & ~VM_SHARED & ~VM_STACK
507  VM_EXEC & ~VM_WRITE & ~VM_STACK 等于 VM_EXEC & ~VM_WRITE & ~VM_STACK
508  VM_STACK 等于 VM_STACK
510  rb_link等于rb_node
511  rb_parent = NULL
512  pprev等于 list of VMAs
513  retval等于ksm_fork(mm, oldmm)
514  如果retval则转到:out
516  retval等于khugepaged_fork(mm, oldmm)
517  如果retval则转到:out
520  prev = NULL
521 mpnt循环
526  继续下一循环
528  charge等于0
534  retval等于负EINTR
535  转到:out
538  len等于vma_pages(mpnt)
542  charge等于len
544  tmp等于vm_area_dup(mpnt)
545  如果非tmp则转到:fail_nomem
547  retval等于vma_dup_policy(mpnt, tmp)
548  如果retval则转到:fail_nomem_policy
550  The address space we belong to. 等于mm
551  retval等于dup_userfaultfd(tmp, & uf)
552  如果retval则转到:fail_nomem_anon_vma_fork
559  否则如果Attach vma to its own anon_vma, as well as to the anon_vmas that* the corresponding VMA in the parent process is attached to.* Returns 0 on success, non-zero on failure.则转到:fail_nomem_anon_vma_fork
561  Flags, see mm.h. 与等于VM_LOCKED按位或Lock the pages covered when they are faulted in 的值的反
562  linked list of VM areas per task, sorted by address = linked list of VM areas per task, sorted by address = NULL
563  file等于File we map to (can be NULL).
564  如果file
565  inode等于file_inode(file)
566  mapping等于f_mapping
568  get_file(file)
587  如果is_vm_hugetlb_page(tmp)则reset_vma_resv_huge_pages(tmp)
593  pprev等于tmp
594  pprev等于linked list of VM areas per task, sorted by address
595  linked list of VM areas per task, sorted by address 等于prev
596  prev等于tmp
598  __vma_link_rb(mm, tmp, rb_link, rb_parent)
599  rb_link等于rb_right
600  rb_parent等于vm_rb
602  number of VMAs 自加
603  如果非Flags, see mm.h. 按位与Wipe VMA contents in child. 的值则retval等于copy_page_range(mm, oldmm, mpnt)
606  如果Function pointers to deal with this struct. openopen(tmp)
609  如果retval则转到:out
613  retval等于arch_dup_mmap(oldmm, mm)
614  out :
615  lease a write lock
616  flush_tlb_mm(oldmm)
617  lease a write lock
618  dup_userfaultfd_complete( & uf)
619  fail_uprobe_end :
620  uprobe_end_dup_mmap()
621  返回: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 :
627  retval等于负ENOMEM
628  vm_unacct_memory(charge)
629  转到:out
调用者
名称描述
dup_mmdup_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.