Function report |
Source Code:mm\mremap.c |
Create Date:2022-07-28 14:53:41 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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.
Proto:SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, unsigned long, new_len, unsigned long, flags, unsigned long, new_addr)
Type:
Parameter:Nothing
602 | charged = 0 |
603 | bool locked = false |
604 | bool downgraded = false |
605 | uf = NULL_VM_UFFD_CTX |
606 | LIST_HEAD(uf_unmap_early) |
611 | If flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE) Then Return ret |
614 | If flags & MREMAP_FIXED && Not (flags & MREMAP_MAYMOVE) Then Return ret |
617 | If offset_in_page(addr) Then Return ret |
631 | If lock for writing Then Return -EINTR |
634 | If flags & MREMAP_FIXED Then |
637 | Go to out |
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 |
655 | Else if retval == 1 Then downgraded = true |
658 | Go to out |
672 | If old_len == The first byte after our end addresswithin vm_mm. - addr Then |
674 | If vma_expandable(vma, new_len - old_len) Then |
675 | pages = new_len - old_len >> PAGE_SHIFT determines the page size |
677 | If vma_adjust(vma, Our start address within vm_mm. , addr + new_len, Offset (within vm_file) in PAGE_SIZEunits , NULL) Then |
683 | vm_stat_account(mm, Flags, see mm.h. , pages) |
684 | If Flags, see mm.h. & VM_LOCKED Then |
690 | Go to out |
699 | If flags & MREMAP_MAYMOVE Then |
700 | map_flags = 0 |
701 | If Flags, see mm.h. & VM_MAYSHARE Then map_flags |= Share changes |
708 | If IS_ERR_VALUE(new_addr) Then |
716 | out : |
717 | If offset_in_page(ret) Then |
718 | vm_unacct_memory(charged) |
719 | locked = 0 |
721 | If downgraded Then lease a read lock |
723 | Else lease a write lock |
728 | mremap_userfaultfd_complete( & uf, addr, new_addr, old_len) |
729 | userfaultfd_unmap_complete(mm, & uf_unmap) |
730 | Return ret |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |