Function report |
Source Code:mm\mmap.c |
Create Date:2022-07-28 14:47:52 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:We cannot adjust vm_start, vm_end, vm_pgoff fields of a vma that* is already present in an i_mmap tree without adjusting the tree.* The following helper function should be used when such adjustments* are necessary
Proto:int __vma_adjust(struct vm_area_struct *vma, unsigned long start, unsigned long end, unsigned long pgoff, struct vm_area_struct *insert, struct vm_area_struct *expand)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct vm_area_struct * | vma | |
unsigned long | start | |
unsigned long | end | |
unsigned long | pgoff | |
struct vm_area_struct * | insert | |
struct vm_area_struct * | expand |
700 | struct address_space * mapping = NULL |
701 | struct rb_root_cached * root = NULL |
704 | bool start_changed = TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., end_changed = false |
705 | adjust_next = 0 |
706 | remove_next = 0 |
709 | struct vm_area_struct * exporter = NULL, * importer = NULL |
711 | If end >= The first byte after our end addresswithin vm_mm. Then |
729 | remove_next = 3 |
730 | VM_WARN_ON(file != File we map to (can be NULL). ) |
732 | Else |
733 | VM_WARN_ON(expand != vma) |
738 | remove_next = 1 + (end > The first byte after our end addresswithin vm_mm. ) |
739 | VM_WARN_ON(remove_next == 2 && end != The first byte after our end addresswithin vm_mm. ) |
752 | If remove_next == 2 && Not Serialized by page_table_lock Then exporter = linked list of VM areas per task, sorted by address |
755 | Else if end > Our start address within vm_mm. Then |
763 | VM_WARN_ON(expand != importer) |
764 | Else if end < The first byte after our end addresswithin vm_mm. Then |
770 | adjust_next = -( The first byte after our end addresswithin vm_mm. - end >> PAGE_SHIFT determines the page size ) |
773 | VM_WARN_ON(expand != importer) |
781 | If exporter && Serialized by page_table_lock && Not Serialized by page_table_lock Then |
785 | error = anon_vma_clone(importer, exporter) |
790 | again : |
791 | vma_adjust_trans_huge(orig_vma, start, end, adjust_next) |
793 | If file Then |
798 | If adjust_next Then Called in context of a munmap of a vma. |
801 | i_mmap_lock_write(mapping) |
802 | If insert Then |
809 | __vma_link_file(insert) |
814 | If Not anon_vma && adjust_next Then anon_vma = Serialized by page_table_lock |
816 | If anon_vma Then |
825 | If root Then |
827 | vma_interval_tree_remove(vma, root) |
828 | If adjust_next Then vma_interval_tree_remove(next, root) |
832 | If start != Our start address within vm_mm. Then |
834 | start_changed = true |
836 | If end != The first byte after our end addresswithin vm_mm. Then |
838 | end_changed = true |
841 | If adjust_next Then |
846 | If root Then |
847 | If adjust_next Then vma_interval_tree_insert(next, root) |
849 | vma_interval_tree_insert(vma, root) |
853 | If remove_next Then |
858 | If remove_next != 3 Then __vma_unlink_common(mm, next, next) |
860 | Else __vma_unlink_common(mm, next, vma) |
871 | If file Then Requires inode->i_mapping->i_mmap_rwsem |
873 | Else if insert Then |
880 | Else |
881 | If start_changed Then Update augmented rbtree rb_subtree_gap values after vma->vm_start or* in the rbtree. |
883 | If end_changed Then |
884 | If Not next Then highest vma end address = vm_end_gap(vma) |
891 | If anon_vma Then |
893 | If adjust_next Then anon_vma_interval_tree_post_update_vma(next) |
897 | If mapping Then i_mmap_unlock_write(mapping) |
900 | If root Then |
907 | If remove_next Then |
908 | If file Then |
912 | If Serialized by page_table_lock Then anon_vma_merge(vma, next) |
914 | number of VMAs -- |
915 | mpol_put(vma_policy(next)) |
916 | vm_area_free(next) |
922 | If remove_next != 3 Then |
930 | Else |
943 | If remove_next == 2 Then |
948 | Else if next Then Update augmented rbtree rb_subtree_gap values after vma->vm_start or* in the rbtree. |
950 | Else |
970 | VM_WARN_ON( highest vma end address != vm_end_gap(vma)) |
973 | If insert && file Then Called from mmap_region/vma_adjust with mm->mmap_sem acquired.* Currently we ignore all errors and always return 0, the callers* can't handle the failure anyway. |
976 | validate_mm(mm) |
978 | Return 0 |
Name | Describe |
---|---|
vma_merge | Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor |
vma_adjust |
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 |