函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:mremap_to

函数原型: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)

返回类型:unsigned long

参数:

类型参数名称
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  如果offset_in_page(new_addr)则转到:out
513  如果new_len大于TASK_SIZEnew_addr大于TASK_SIZEnew_len则转到:out
517  如果addrold_len大于new_addrnew_addrnew_len大于addr则转到:out
534  如果 number of VMAs 加2大于等于sysctl_max_map_count减3则返回:负ENOMEM
537  ret等于do_munmap(mm, new_addr, new_len, uf_unmap_early)
538  如果ret则转到:out
541  如果old_len大于等于new_len
542  ret等于do_munmap(mm, addr + new_len, old_len - new_len, uf_unmap)
543  如果retold_len不等于new_len则转到:out
545  old_len等于new_len
548  vma等于vma_to_resize(addr, old_len, new_len, & charged)
549  如果是错误
550  ret等于错误
551  转到:out
554  map_flags等于Interpret addr exactly
555  如果Flags, see mm.h. 按位与VM_MAYSHAREmap_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  如果IS_ERR_VALUE(ret)则转到:out1
564  ret等于move_vma(vma, addr, old_len, new_len, new_addr, locked, uf, uf_unmap)
566  如果非offset_in_page(ret)则转到:out
568  out1 :
569  vm_unacct_memory(charged)
571  out :
572  返回:ret
调用者
名称描述
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.