Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:mremap_to

Proto:static unsigned long mremap_to(unsigned long addr, unsigned long old_len, unsigned long new_addr, unsigned long new_len, bool *locked, struct vm_userfaultfd_ctx *uf, struct list_head *uf_unmap_early, struct list_head *uf_unmap)

Type:unsigned long

Parameter:

TypeParameterName
unsigned longaddr
unsigned longold_len
unsigned longnew_addr
unsigned longnew_len
bool *locked
struct vm_userfaultfd_ctx *uf
struct list_head *uf_unmap_early
struct list_head *uf_unmap
504  mm = mm
506  ret = -EINVAL
507  charged = 0
510  If offset_in_page(new_addr) Then Go to out
513  If new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len Then Go to out
517  If addr + old_len > new_addr && new_addr + new_len > addr Then Go to out
534  If number of VMAs + 2 >= sysctl_max_map_count - 3 Then Return -ENOMEM
537  ret = do_munmap(mm, new_addr, new_len, uf_unmap_early)
538  If ret Then Go to out
541  If old_len >= new_len Then
542  ret = do_munmap(mm, addr + new_len, old_len - new_len, uf_unmap)
543  If ret && old_len != new_len Then Go to out
545  old_len = new_len
548  vma = vma_to_resize(addr, old_len, new_len, & charged)
549  If IS_ERR(vma) Then
550  ret = PTR_ERR(vma)
551  Go to out
554  map_flags = Interpret addr exactly
555  If Flags, see mm.h. & VM_MAYSHARE Then map_flags |= Share changes
558  ret = get_unmapped_area(File we map to (can be NULL). , new_addr, new_len, Offset (within vm_file) in PAGE_SIZEunits + ((addr - Our start address within vm_mm. ) >> PAGE_SHIFT determines the page size ), map_flags)
561  If IS_ERR_VALUE(ret) Then Go to out1
564  ret = move_vma(vma, addr, old_len, new_len, new_addr, locked, uf, uf_unmap)
566  If Not offset_in_page(ret) Then Go to out
568  out1 :
569  vm_unacct_memory(charged)
571  out :
572  Return ret
Caller
NameDescribe
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.