From e9e171a435e8bf2526b2df5036af3b7e9bd4c3ae Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 21 Apr 2022 17:59:15 -0400 Subject: [PATCH] mm/internal.h: Convert vma_mas_remove and store to store_prealloc Signed-off-by: Liam R. Howlett --- mm/internal.h | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 3066b296d7cb..5a39dc426f0a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -470,30 +470,11 @@ static inline bool is_data_mapping(vm_flags_t flags) * * 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) -{ -#ifdef CONFIG_DEBUG_VM_MAPLE_TREE - /* Make sure no VMAs are about to be lost. */ - MA_STATE(test, mas->tree, vma->vm_start, vma->vm_end - 1); - struct vm_area_struct *vma_mas; - int count = 0; - - mas_for_each(&test, vma_mas, vma->vm_end - 1) { - /* Rule out vma_expand */ - if ((vma->vm_start != vma_mas->vm_start) && - (vma->vm_end != vma_mas->vm_end)) - count++; - } - - /* vma adjust may overwrite a partial entry or remove one */ - BUG_ON(count > 1); - - BUG_ON(mas->min > vma->vm_start); - BUG_ON(mas->index > vma->vm_start); -#endif +static inline void vma_mas_store(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, vma, GFP_KERNEL); + mas_store_prealloc(mas, vma); } /* @@ -505,28 +486,11 @@ static inline int vma_mas_store(struct vm_area_struct *vma, struct ma_state *mas * 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) +static inline void vma_mas_remove(struct vm_area_struct *vma, struct ma_state *mas) { - int ret; - -#ifdef CONFIG_DEBUG_VM_MAPLE_TREE - /* Make sure no VMAs are about to be lost. */ - MA_STATE(test, mas->tree, vma->vm_start, vma->vm_end - 1); - struct vm_area_struct *vma_mas; - int count = 0; - - mas_for_each(&test, vma_mas, vma->vm_end - 1) - count++; - - BUG_ON(count != 1); - - BUG_ON(mas->min > vma->vm_start); - BUG_ON(mas->min > mas->index); -#endif mas->index = vma->vm_start; mas->last = vma->vm_end - 1; - ret = mas_store_gfp(mas, NULL, GFP_KERNEL); - return ret; + mas_store_prealloc(mas, NULL); } /* mm/util.c */ -- 2.49.0