From ee878dbb8db511da9b3ba50e738989c5afd4cfc0 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Mon, 4 Jan 2021 13:54:34 -0500 Subject: [PATCH] mm/mmap.c: Comment and whitespace fixes Signed-off-by: Liam R. Howlett --- mm/mmap.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 1b20f042ea57..09fe2a96723d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -430,6 +430,16 @@ static void __vma_link_file(struct vm_area_struct *vma) } } +/* + * vma_mas_store() - Store a VMA in the maple tree. + * @vma: The vm_area_struct + * @mas: The maple state + * + * Efficient way to store a VMA in the maple tree when the @mas has already + * walked to the correct location. + * + * Note: the end address is inclusive in the maple tree. + */ static inline int vma_mas_store(struct vm_area_struct *vma, struct ma_state *mas) { mas->index = vma->vm_start; @@ -437,30 +447,31 @@ static inline int vma_mas_store(struct vm_area_struct *vma, struct ma_state *mas return mas_store_gfp(mas, vma, GFP_KERNEL); } +/* + * vma_mas_remove() - Remove a VMA from the maple tree. + * @vma: The vm_area_struct + * @mas: The maple state + * + * Efficient way to remove a VMA from the maple tree when the @mas has already + * been established and points to the correct location. + * Note: the end address is inclusive in the maple tree. + */ static inline int vma_mas_remove(struct vm_area_struct *vma, struct ma_state *mas) { mas->index = vma->vm_start; mas->last = vma->vm_end - 1; return mas_store_gfp(mas, NULL, GFP_KERNEL); } + /* - * vma_mt_erase() - erase a VMA entry from the maple tree. - * - * @mm: The struct_mm - * @vma: The vm_area_struct to erase from the maple tree. - */ -static inline void vma_mt_erase(struct mm_struct *mm, struct vm_area_struct *vma) -{ - trace_vma_mt_erase(mm, vma); - mtree_erase(&mm->mm_mt, vma->vm_start); -} -/* - * vma_mt_szero() - Set a given range to zero. Used when modifying a - * vm_area_struct start or end. - * + * vma_mt_szero() - Clear a given range from the maple tree. * @mm: The struct_mm * @start: The start address to zero * @end: The end address to zero. + * + * Used when modifying a vm_area_struct start or end and there is no maple state + * pointing to the correct location. + * Note: the end address is inclusive in the maple tree. */ static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start, unsigned long end) @@ -470,9 +481,11 @@ static inline void vma_mt_szero(struct mm_struct *mm, unsigned long start, } /* * vma_mt_store() - Store a given vm_area_struct in the maple tree. - * * @mm: The struct_mm * @vma: The vm_area_struct to store in the maple tree. + * + * Used when there is no maple state pointing to the correct location. + * Note: the end address is inclusive in the maple tree. */ static inline void vma_mt_store(struct mm_struct *mm, struct vm_area_struct *vma) { @@ -591,7 +604,6 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma, /* Expanding over the next vma */ if (remove_next) { - /* Remove from mm linked list - also updates highest_vm_end */ if (file) __remove_shared_vm_struct(next, file, mapping); } @@ -2201,6 +2213,7 @@ static void unmap_region(struct mm_struct *mm, max); tlb_finish_mmu(&tlb, start, end); } + /* * __split_vma() bypasses sysctl_max_map_count checking. We use this where it * has already been checked or doesn't make sense to fail. -- 2.50.1