函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Munmap is split into 2 main parts -- this part which finds* what needs doing, and the areas themselves, which do the* work. This now handles partial unmappings.* Jeremy Fitzhardinge <jeremy@goop.org>

函数原型:int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, struct list_head *uf, bool downgrade)

返回类型:int

参数:

类型参数名称
struct mm_struct *mm
unsigned longstart
size_tlen
struct list_head *uf
booldowngrade
2718  如果offset_in_page(start)或start大于TASK_SIZElen大于TASK_SIZEstart则返回:负EINVAL
2721  len等于 align the pointer to the (next) page boundary (len)
2722  end等于startlen
2723  如果len恒等于0则返回:负EINVAL
2731  arch_unmap(mm, start, end)
2734  vma等于Look up the first VMA which satisfies addr < vm_end, NULL if none.
2735  如果非vma则返回:0
2737  prev等于linked list of VM areas per task, sorted by address
2741  如果Our start address within vm_mm. 大于等于end则返回:0
2751  如果start大于Our start address within vm_mm.
2759  如果end小于The first byte after our end addresswithin vm_mm. number of VMAs 大于等于sysctl_max_map_count则返回:负ENOMEM
2762  error等于__split_vma() bypasses sysctl_max_map_count checking. We use this where it* has already been checked or doesn't make sense to fail.
2763  如果error则返回:error
2765  prev等于vma
2769  last等于Look up the first VMA which satisfies addr < vm_end, NULL if none.
2770  如果lastend大于Our start address within vm_mm.
2771  error等于__split_vma() bypasses sysctl_max_map_count checking. We use this where it* has already been checked or doesn't make sense to fail.
2772  如果error则返回:error
2775  vma等于如果prevlinked list of VM areas per task, sorted by address 否则 list of VMAs
2777  如果此条件成立可能性小(为编译器优化)(uf)则
2787  error等于userfaultfd_unmap_prep(vma, start, end, uf)
2788  如果error则返回:error
2795  如果 Pages that have PG_mlocked set
2796  tmp等于vma
2798  如果Flags, see mm.h. 按位与VM_LOCKED
2808  Create a list of vma's touched by the unmap, removing them from the mm's* vma list as we go..
2810  如果downgradedowngrade write lock to read lock
2813  unmap_region(mm, vma, prev, start, end)
2816  Ok - we have the memory areas we should free on the vma list,* so release them, and do the vma updates.* Called with the mm semaphore held.
2818  返回:如果downgrade则1否则0
调用者
名称描述
SYSCALL_DEFINE1
do_munmap
__vm_munmap
SYSCALL_DEFINE5Expand (or shrink) an existing mapping, potentially moving it at the* same time (controlled by the MREMAP_MAYMOVE flag and available VM space)* MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise* This option implies MREMAP_MAYMOVE.