summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2022-03-23 00:42:33 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-23 01:57:05 +0300
commitf9871da927437dc85bc3fec206fc9bfddea4a34b (patch)
tree959ab0a659abc0c1cbe744b69a6051d3ff5dc163 /mm/memory.c
parent88a359125a2b8f2437f09ab3b1af4815c89690d4 (diff)
downloadlinux-f9871da927437dc85bc3fec206fc9bfddea4a34b.tar.xz
mm/memory.c: use helper macro min and max in unmap_mapping_range_tree()
Use helper macro min and max to help simplify the code logic. Minor readability improvement. Link: https://lkml.kernel.org/r/20220224121134.35068-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 3cbcf3a3e20a..c96281458c83 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3350,12 +3350,8 @@ static inline void unmap_mapping_range_tree(struct rb_root_cached *root,
vma_interval_tree_foreach(vma, root, first_index, last_index) {
vba = vma->vm_pgoff;
vea = vba + vma_pages(vma) - 1;
- zba = first_index;
- if (zba < vba)
- zba = vba;
- zea = last_index;
- if (zea > vea)
- zea = vea;
+ zba = max(first_index, vba);
+ zea = min(last_index, vea);
unmap_mapping_range_vma(vma,
((zba - vba) << PAGE_SHIFT) + vma->vm_start,