Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:his is really a simplified "do_mmap". it only handles* anonymous maps. eventually we may be able to do some* brk-specific accounting here.

Proto:static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags, struct list_head *uf)

Type:int

Parameter:

TypeParameterName
unsigned longaddr
unsigned longlen
unsigned longflags
struct list_head *uf
2972  mm = mm
2975  pgoff = addr >> PAGE_SHIFT determines the page size
2980  If (flags & ~VM_EXEC) != 0 Then Return -EINVAL
2982  flags |= VM_DATA_DEFAULT_FLAGS | Is a VM accounted object | def_flags
2984  mapped_addr = get_unmapped_area(NULL, addr, len, 0, Interpret addr exactly )
2985  If IS_ERR_VALUE(mapped_addr) Then Return mapped_addr
2988  error = mlock_future_check(mm, def_flags, len)
2989  If error Then Return error
2995  When find_vma_links(mm, addr, addr + len, & prev, & rb_link, & rb_parent) cycle
2997  If do_munmap(mm, addr, len, uf) Then Return -ENOMEM
3002  If Not Return true if the calling process may expand its vm space by the passed* number of pages Then Return -ENOMEM
3005  If number of VMAs > sysctl_max_map_count Then Return -ENOMEM
3008  If security_vm_enough_memory_mm(mm, len >> PAGE_SHIFT determines the page size ) Then Return -ENOMEM
3012  vma = Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor
3014  If vma Then Go to out
3020  vma = vm_area_alloc(mm)
3021  If Not vma Then
3022  vm_unacct_memory(len >> PAGE_SHIFT determines the page size )
3023  Return -ENOMEM
3026  vma_set_anonymous(vma)
3027  Our start address within vm_mm. = addr
3028  The first byte after our end addresswithin vm_mm. = addr + len
3029  Offset (within vm_file) in PAGE_SIZEunits = pgoff
3030  Flags, see mm.h. = flags
3031  Access permissions of this VMA. = vm_get_page_prot(flags)
3032  vma_link(mm, vma, prev, rb_link, rb_parent)
3033  out :
3034  perf_event_mmap(vma)
3035  Total pages mapped += len >> PAGE_SHIFT determines the page size
3036  VM_WRITE & ~VM_SHARED & ~VM_STACK += len >> PAGE_SHIFT determines the page size
3037  If flags & VM_LOCKED Then Pages that have PG_mlocked set += len >> PAGE_SHIFT determines the page size
3039  Flags, see mm.h. |= VM_SOFTDIRTY
3040  Return 0
Caller
NameDescribe
SYSCALL_DEFINE1
vm_brk_flags