Patch series "mm: mmap: add mmap trace point", v3. Create mmap trace file and add trace point of vm_unmapped_area(). This patch (of 2): In preparation for next patch remove inline of vm_unmapped_area and move code to mmap.c. There is no logical change. Also remove unmapped_area[_topdown] out of mm.h, there is no code calling to them.
Unified · Split
| @@ -2530,26 +2530,7 @@ struct vm_unmapped_area_info { · 2529 unmodified lines | |||
| 2530 | unsigned long align_offset; | 2530 | unsigned long align_offset; |
| 2531 | }; | 2531 | }; |
| 2532 | 2532 | ||
| 2533 | extern unsigned long unmapped_area(struct vm_unmapped_area_info *info); | 2533 | extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info); |
| 2534 | extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info); | ||
| 2535 | |||
| 2536 | /* | ||
| 2537 | * Search for an unmapped address range. | ||
| 2538 | * | ||
| 2539 | * We are looking for a range that: | ||
| 2540 | * - does not intersect with any VMA; | ||
| 2541 | * - is contained within the [low_limit, high_limit) interval; | ||
| 2542 | * - is at least the desired size. | ||
| 2543 | * - satisfies (begin_addr & align_mask) == (align_offset & align_mask) | ||
| 2544 | */ | ||
| 2545 | static inline unsigned long | ||
| 2546 | vm_unmapped_area(struct vm_unmapped_area_info *info) | ||
| 2547 | { | ||
| 2548 | if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) | ||
| 2549 | return unmapped_area_topdown(info); | ||
| 2550 | else | ||
| 2551 | return unmapped_area(info); | ||
| 2552 | } | ||
| 2553 | 2534 | ||
| 2554 | /* truncate.c */ | 2535 | /* truncate.c */ |
| 2555 | extern void truncate_inode_pages(struct address_space *, loff_t); | 2536 | extern void truncate_inode_pages(struct address_space *, loff_t); |
| @@ -1848,7 +1848,7 @@ unacct_error: · 1847 unmodified lines | |||
| 1848 | return error; | 1848 | return error; |
| 1849 | } | 1849 | } |
| 1850 | 1850 | ||
| 1851 | unsigned long unmapped_area(struct vm_unmapped_area_info *info) | 1851 | static unsigned long unmapped_area(struct vm_unmapped_area_info *info) |
| 1852 | { | 1852 | { |
| 1853 | /* | 1853 | /* |
| 1854 | * We implement the search by looking for an rbtree node that | 1854 | * We implement the search by looking for an rbtree node that |
| @@ -1951,7 +1951,7 @@ found: · 96 unmodified lines | |||
| 1951 | return gap_start; | 1951 | return gap_start; |
| 1952 | } | 1952 | } |
| 1953 | 1953 | ||
| 1954 | unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) | 1954 | static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) |
| 1955 | { | 1955 | { |
| 1956 | struct mm_struct *mm = current->mm; | 1956 | struct mm_struct *mm = current->mm; |
| 1957 | struct vm_area_struct *vma; | 1957 | struct vm_area_struct *vma; |
| @@ -2050,6 +2050,22 @@ found_highest: · 92 unmodified lines | |||
| 2050 | return gap_end; | 2050 | return gap_end; |
| 2051 | } | 2051 | } |
| 2052 | 2052 | ||
| 2053 | /* | ||
| 2054 | * Search for an unmapped address range. | ||
| 2055 | * | ||
| 2056 | * We are looking for a range that: | ||
| 2057 | * - does not intersect with any VMA; | ||
| 2058 | * - is contained within the [low_limit, high_limit) interval; | ||
| 2059 | * - is at least the desired size. | ||
| 2060 | * - satisfies (begin_addr & align_mask) == (align_offset & align_mask) | ||
| 2061 | */ | ||
| 2062 | unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) | ||
| 2063 | { | ||
| 2064 | if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) | ||
| 2065 | return unmapped_area_topdown(info); | ||
| 2066 | else | ||
| 2067 | return unmapped_area(info); | ||
| 2068 | } | ||
| 2053 | 2069 | ||
| 2054 | #ifndef arch_get_mmap_end | 2070 | #ifndef arch_get_mmap_end |
| 2055 | #define arch_get_mmap_end(addr) (TASK_SIZE) | 2071 | #define arch_get_mmap_end(addr) (TASK_SIZE) |