diff options
| author | Lorenzo Stoakes <ljs@kernel.org> | 2026-07-10 21:16:47 +0100 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-08-04 19:18:57 -0700 |
| commit | 7a67b96af06929b515947ebd4786c9cf1847e58f (patch) | |
| tree | 3d3bd9e9788259c7b61cb4c41f7a567dc8ae13ce /include | |
| parent | dbde17041cbf26606436f844457b12f9a45b90d7 (diff) | |
| download | linux-next-7a67b96af06929b515947ebd4786c9cf1847e58f.tar.gz linux-next-7a67b96af06929b515947ebd4786c9cf1847e58f.zip | |
mm/rmap: parameterise vma_interval_tree_*() by address_space
The file-backed mapping interval tree functions vma_interval_tree_*()
accept a raw rb_root_cached pointer to determine the tree in which they are
operating.
However, in each case, this is always associated with an address_space data
type.
So simply pass a pointer to that instead to simplify the code, and more
clearly differentiate between these operations and those concerning
anonymous mappings.
While we're here, make the generated interval tree functions static as they
do not need to be used externally (any previously existing external users
have now been removed).
We also rename VMA parameters from 'node' to 'vma' as calling this a node
is simply confusing, update the input index types to pgoff_t since they
reference page offsets and rename the parameters to pgoff_start and
pgoff_last.
No functional change intended.
Link: https://lore.kernel.org/20260710-b4-pre-scalable-cow-v2-6-2a5aa403d977@kernel.org
Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Ackerley Tng <ackerleytng@google.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Kai Huang <kai.huang@intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: SJ Park <sj@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Liam R. Howlett (Oracle) <liam@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mm.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3e45978812e2..349d59a737eb 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4094,23 +4094,25 @@ extern atomic_long_t mmap_pages_allocated; extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); /* interval_tree.c */ -void vma_interval_tree_insert(struct vm_area_struct *node, - struct rb_root_cached *root); -void vma_interval_tree_insert_after(struct vm_area_struct *node, +void vma_interval_tree_insert(struct vm_area_struct *vma, + struct address_space *mapping); +void vma_interval_tree_insert_after(struct vm_area_struct *vma, struct vm_area_struct *prev, - struct rb_root_cached *root); -void vma_interval_tree_remove(struct vm_area_struct *node, - struct rb_root_cached *root); -struct vm_area_struct *vma_interval_tree_subtree_search(struct vm_area_struct *node, - unsigned long start, unsigned long last); -struct vm_area_struct *vma_interval_tree_iter_first(struct rb_root_cached *root, - unsigned long start, unsigned long last); -struct vm_area_struct *vma_interval_tree_iter_next(struct vm_area_struct *node, - unsigned long start, unsigned long last); - -#define vma_interval_tree_foreach(vma, root, start, last) \ - for (vma = vma_interval_tree_iter_first(root, start, last); \ - vma; vma = vma_interval_tree_iter_next(vma, start, last)) + struct address_space *mapping); +void vma_interval_tree_remove(struct vm_area_struct *vma, + struct address_space *mapping); +struct vm_area_struct * +vma_interval_tree_iter_first(struct address_space *mapping, + pgoff_t pgoff_start, pgoff_t pgoff_last); +struct vm_area_struct * +vma_interval_tree_iter_next(struct vm_area_struct *vma, + pgoff_t pgoff_start, pgoff_t pgoff_last); + +#define vma_interval_tree_foreach(vma, mapping, pgoff_start, pgoff_last) \ + for (vma = vma_interval_tree_iter_first(mapping, pgoff_start, \ + pgoff_last); \ + vma; vma = vma_interval_tree_iter_next(vma, pgoff_start, \ + pgoff_last)) void anon_vma_interval_tree_insert(struct anon_vma_chain *node, struct rb_root_cached *root); |
