* [PATCH] mm: use helper macro min and max in unmap_mapping_range_tree
@ 2022-02-24 12:11 Miaohe Lin
0 siblings, 0 replies; only message in thread
From: Miaohe Lin @ 2022-02-24 12:11 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, linmiaohe
Use helper macro min and max to help simplify the code logic. Minor
readability improvement.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/memory.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 47b667f6b600..7d0f80135a41 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3339,12 +3339,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,
--
2.23.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-24 12:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 12:11 [PATCH] mm: use helper macro min and max in unmap_mapping_range_tree Miaohe Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox