函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Expand (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.

函数原型:SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, unsigned long, new_len, unsigned long, flags, unsigned long, new_addr)

返回类型:

参数:

599  mm等于mm
601  ret等于负EINVAL
602  charged等于0
603  bool locked = false
604  bool downgraded = false
605  uf等于NULL_VM_UFFD_CTX
606  LIST_HEAD(uf_unmap_early)
607  LIST_HEAD(uf_unmap)
609  addr等于Architectures that support memory tagging (assigning tags to memory regions,* embedding these tags into addresses that point to these memory regions, and* checking that the memory and the pointer tags match on memory accesses)(addr)
611  如果flags按位与MREMAP_FIXED按位或MREMAP_MAYMOVE的值的反则返回:ret
614  如果flags按位与MREMAP_FIXED且非flags按位与MREMAP_MAYMOVE的值则返回:ret
617  如果offset_in_page(addr)则返回:ret
620  old_len等于 align the pointer to the (next) page boundary (old_len)
621  new_len等于 align the pointer to the (next) page boundary (new_len)
628  如果非new_len则返回:ret
631  如果lock for writing则返回:负EINTR
634  如果flags按位与MREMAP_FIXED
635  ret等于mremap_to(addr, old_len, new_addr, new_len, & locked, & uf, & uf_unmap_early, & uf_unmap)
637  转到:out
646  如果old_len大于等于new_len
649  retval等于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
651  如果retval小于0且old_len不等于new_len
652  ret等于retval
653  转到:out
655  否则如果retval恒等于1则downgraded = true
657  ret等于addr
658  转到:out
664  vma等于vma_to_resize(addr, old_len, new_len, & charged)
665  如果是错误
666  ret等于错误
667  转到:out
672  如果old_len恒等于The first byte after our end addresswithin vm_mm. addr
674  如果vma_expandable(vma, new_len - old_len)则
679  ret等于负ENOMEM
680  转到:out
684  如果Flags, see mm.h. 按位与VM_LOCKED
686  locked = true
687  new_addr等于addr
689  ret等于addr
690  转到:out
698  ret等于负ENOMEM
699  如果flags按位与MREMAP_MAYMOVE
700  map_flags等于0
701  如果Flags, see mm.h. 按位与VM_MAYSHAREmap_flags或等于Share changes
704  new_addr等于get_unmapped_area(File we map to (can be NULL). , 0, new_len, Offset (within vm_file) in PAGE_SIZEunits + ((addr - Our start address within vm_mm. ) >> PAGE_SHIFT determines the page size ), map_flags)
708  如果IS_ERR_VALUE(new_addr)则
709  ret等于new_addr
710  转到:out
713  ret等于move_vma(vma, addr, old_len, new_len, new_addr, & locked, & uf, & uf_unmap)
716  out :
717  如果offset_in_page(ret)则
718  vm_unacct_memory(charged)
719  locked等于0
721  如果downgradedlease a read lock
723  否则lease a write lock
725  如果lockednew_len大于old_lenmm_populate(new_addr + old_len, new_len - old_len)
727  userfaultfd_unmap_complete(mm, & uf_unmap_early)
728  mremap_userfaultfd_complete( & uf, addr, new_addr, old_len)
729  userfaultfd_unmap_complete(mm, & uf_unmap)
730  返回:ret