Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mmap.c Create Date:2022-07-28 14:49:44
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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>

Proto:int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len, struct list_head *uf, bool downgrade)

Type:int

Parameter:

TypeParameterName
struct mm_struct *mm
unsigned longstart
size_tlen
struct list_head *uf
booldowngrade
2718  If offset_in_page(start) || start > TASK_SIZE || len > TASK_SIZE - start Then Return -EINVAL
2721  len = align the pointer to the (next) page boundary (len)
2722  end = start + len
2723  If len == 0 Then Return -EINVAL
2731  arch_unmap(mm, start, end)
2734  vma = Look up the first VMA which satisfies addr < vm_end, NULL if none.
2735  If Not vma Then Return 0
2737  prev = linked list of VM areas per task, sorted by address
2741  If Our start address within vm_mm. >= end Then Return 0
2751  If start > Our start address within vm_mm. Then
2759  If end < The first byte after our end addresswithin vm_mm. && number of VMAs >= sysctl_max_map_count Then Return -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  If error Then Return error
2765  prev = vma
2769  last = Look up the first VMA which satisfies addr < vm_end, NULL if none.
2770  If last && end > Our start address within vm_mm. Then
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  If error Then Return error
2775  vma = If prev Then linked list of VM areas per task, sorted by address Else list of VMAs
2777  If Value for the false possibility is greater at compile time(uf) Then
2787  error = userfaultfd_unmap_prep(vma, start, end, uf)
2788  If error Then Return error
2795  If Pages that have PG_mlocked set Then
2796  tmp = vma
2798  If Flags, see mm.h. & VM_LOCKED Then
2808  Create a list of vma's touched by the unmap, removing them from the mm's* vma list as we go..
2810  If downgrade Then downgrade 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  Return If downgrade Then 1 Else 0
Caller
NameDescribe
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.