From b480846815f90b00b4c12ffd7e7ca9b60a28f7d1 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 19 Nov 2020 12:15:05 -0500 Subject: [PATCH] mm: Clean up modifications Signed-off-by: Liam R. Howlett --- include/linux/mm.h | 11 +++++------ include/linux/mmdebug.h | 2 +- include/linux/radix-tree.h | 2 +- include/linux/xarray.h | 30 ++---------------------------- mm/mmap.c | 10 +++------- 5 files changed, 12 insertions(+), 43 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 110aa7524e4b..996353a05750 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2588,11 +2588,11 @@ static inline void mm_populate(unsigned long addr, unsigned long len) (void) __mm_populate(addr, len, 1); } extern void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, - unsigned long end); + unsigned long end); #else static inline void mm_populate(unsigned long addr, unsigned long len) {} -extern void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, - unsigned long end) {} +void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, + unsigned long end) {} #endif /* These take the mm semaphore themselves */ @@ -2651,9 +2651,8 @@ extern struct vm_area_struct * find_vma_prev(struct mm_struct * mm, unsigned lon /* Look up the first VMA which intersects the interval start_addr..end_addr-1, NULL if none. Assume start_addr < end_addr. */ -extern struct vm_area_struct * find_vma_intersection(struct mm_struct * mm, - unsigned long start_addr, - unsigned long end_addr); +extern struct vm_area_struct *find_vma_intersection(struct mm_struct *mm, + unsigned long start_addr, unsigned long end_addr); static inline unsigned long vm_start_gap(struct vm_area_struct *vma) { diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 9d5852b07002..2ad72d2c8cc5 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -13,7 +13,7 @@ extern void dump_page(struct page *page, const char *reason); extern void __dump_page(struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); -#define CONFIG_DEBUG_VM 1 + #ifdef CONFIG_DEBUG_VM #define VM_BUG_ON(cond) BUG_ON(cond) #define VM_BUG_ON_PAGE(cond, page) \ diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 42b8fa3137d8..64ad900ac742 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -11,13 +11,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include /* Keep unconverted code working */ #define radix_tree_root xarray diff --git a/include/linux/xarray.h b/include/linux/xarray.h index 4e8a2f5c5d7e..92c0160b3352 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -169,7 +169,7 @@ static inline bool xa_is_internal(const void *entry) return ((unsigned long)entry & 3) == 2; } -#define XA_ZERO_ENTRY xa_mk_internal(259) +#define XA_ZERO_ENTRY xa_mk_internal(257) /** * xa_is_zero() - Is the entry a zero entry? @@ -1261,32 +1261,6 @@ static inline bool xa_is_retry(const void *entry) return unlikely(entry == XA_RETRY_ENTRY); } -#define XA_SKIP_ENTRY xa_mk_internal(257) - -/** - * xa_is_skip() - Is the entry a skip entry? - * @entry: Entry retrieved from the XArray - * - * Return: %true if the entry is a skip entry. - */ -static inline bool xa_is_skip(const void *entry) -{ - return unlikely(entry == XA_SKIP_ENTRY); -} - -#define XA_DELETED_ENTRY xa_mk_internal(258) - -/** - * xa_is_deleted() - has the entry been deleted? - * @entry: Entry retrieved from the XArray - * - * Return: %true if the entry has been deleted. - */ -static inline bool xa_is_deleted(const void *entry) -{ - return unlikely(entry == XA_DELETED_ENTRY); -} - /** * xa_is_advanced() - Is the entry only permitted for the advanced API? * @entry: Entry to be stored in the XArray. @@ -1295,7 +1269,7 @@ static inline bool xa_is_deleted(const void *entry) */ static inline bool xa_is_advanced(const void *entry) { - return xa_is_internal(entry) && (entry < XA_ZERO_ENTRY); + return xa_is_internal(entry) && (entry <= XA_RETRY_ENTRY); } /** diff --git a/mm/mmap.c b/mm/mmap.c index 6bbade6232eb..6570953f25e8 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -273,9 +273,9 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) goto out; /* Ok, looks good - let it rip. */ - if (do_brk_flags(&mas, &brkvma, oldbrk, newbrk-oldbrk, 0) < 0) { + if (do_brk_flags(&mas, &brkvma, oldbrk, newbrk-oldbrk, 0) < 0) goto out; - } + mm->brk = brk; success: @@ -893,12 +893,8 @@ again: vma->vm_pgoff = pgoff; if (adjust_next) { - // maple tree erase is unnecessary as the adjusting of the vma - // would have overwritten the area. next->vm_start += adjust_next; next->vm_pgoff += adjust_next >> PAGE_SHIFT; - // the vma_store is necessary as the adjust_next may be - // negative and expand backwards. vma_mt_store(mm, next); } @@ -3061,7 +3057,7 @@ static int do_brk_flags(struct ma_state *mas, struct vm_area_struct **brkvma, if (brkvma) { vma = *brkvma; /* Fast path, expand the existing vma if possible */ - if (vma && ((vma->vm_flags & ~VM_SOFTDIRTY) == flags)){ + if (vma && ((vma->vm_flags & ~VM_SOFTDIRTY) == flags)) { vma->vm_end = addr + len; mas->index = vma->vm_start; mas->last = vma->vm_end - 1; -- 2.50.1