With __install_special_mapping() moved to vma.c, vma_set_range() can be made into a static function there and is now completely isolated from the rest of mm.
While we're here, we can also remove the insert_vm_struct() declaration from mm.h - the function is implemented in vma.c and already declared in vma.h, and has no users outside of mm. Also update the VMA userland tests to reflect this change. No functional change intended. Signed-off-by: Lorenzo Stoakes <[email protected]> --- include/linux/mm.h | 1 - mm/internal.h | 9 --------- mm/vma.c | 8 ++++++++ tools/testing/vma/shared.c | 9 --------- tools/testing/vma/shared.h | 5 ----- 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index cf2d42747064..868b2334bff3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4103,7 +4103,6 @@ void anon_vma_interval_tree_verify(struct anon_vma_chain *avc); /* mmap.c */ extern int __vm_enough_memory(const struct mm_struct *mm, long pages, int cap_sys_admin); -extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void exit_mmap(struct mm_struct *); bool mmap_read_lock_maybe_expand(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, bool write); diff --git a/mm/internal.h b/mm/internal.h index 89e5b7efe256..e127dfea9c0f 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1720,15 +1720,6 @@ extern bool mirrored_kernelcore; bool memblock_has_mirror(void); void memblock_free_all(void); -static __always_inline void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff) -{ - vma->vm_start = start; - vma->vm_end = end; - vma->vm_pgoff = pgoff; -} - static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) { /* diff --git a/mm/vma.c b/mm/vma.c index f4de706a2728..b16c5b20862f 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -70,6 +70,14 @@ struct mmap_state { .state = VMA_MERGE_START, \ } +static void vma_set_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end, pgoff_t pgoff) +{ + vma->vm_start = start; + vma->vm_end = end; + vma->vm_pgoff = pgoff; +} + /* Was this VMA ever forked from a parent, i.e. maybe contains CoW mappings? */ static bool vma_is_fork_child(struct vm_area_struct *vma) { diff --git a/tools/testing/vma/shared.c b/tools/testing/vma/shared.c index 2565a5aecb80..bea9ea6db02a 100644 --- a/tools/testing/vma/shared.c +++ b/tools/testing/vma/shared.c @@ -120,12 +120,3 @@ unsigned long rlimit(unsigned int limit) { return (unsigned long)-1; } - -void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff) -{ - vma->vm_start = start; - vma->vm_end = end; - vma->vm_pgoff = pgoff; -} diff --git a/tools/testing/vma/shared.h b/tools/testing/vma/shared.h index 8b9e3b11c3cb..ca4f1238f1c7 100644 --- a/tools/testing/vma/shared.h +++ b/tools/testing/vma/shared.h @@ -125,8 +125,3 @@ void __vma_set_dummy_anon_vma(struct vm_area_struct *vma, /* Provide a simple dummy VMA/anon_vma dummy setup for testing. */ void vma_set_dummy_anon_vma(struct vm_area_struct *vma, struct anon_vma_chain *avc); - -/* Helper function to specify a VMA's range. */ -void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff); -- 2.54.0
