The patch titled Subject: mm/damon/vaddr: remove swap_ranges() and replace it with swap() has been added to the -mm tree. Its filename is mm-damon-vaddr-remove-swap_ranges-and-replace-it-with-swap.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-damon-vaddr-remove-swap_ranges-and-replace-it-with-swap.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-damon-vaddr-remove-swap_ranges-and-replace-it-with-swap.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yihao Han <hanyihao@xxxxxxxx> Subject: mm/damon/vaddr: remove swap_ranges() and replace it with swap() Remove 'swap_ranges()' and replace it with the macro 'swap()' defined in 'include/linux/minmax.h' to simplify code and improve efficiency Link: https://lkml.kernel.org/r/20211111115355.2808-1-hanyihao@xxxxxxxx Signed-off-by: Yihao Han <hanyihao@xxxxxxxx> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx> Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/damon/vaddr.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) --- a/mm/damon/vaddr.c~mm-damon-vaddr-remove-swap_ranges-and-replace-it-with-swap +++ a/mm/damon/vaddr.c @@ -97,16 +97,6 @@ static unsigned long sz_range(struct dam return r->end - r->start; } -static void swap_ranges(struct damon_addr_range *r1, - struct damon_addr_range *r2) -{ - struct damon_addr_range tmp; - - tmp = *r1; - *r1 = *r2; - *r2 = tmp; -} - /* * Find three regions separated by two biggest unmapped regions * @@ -145,9 +135,9 @@ static int __damon_va_three_regions(stru gap.start = last_vma->vm_end; gap.end = vma->vm_start; if (sz_range(&gap) > sz_range(&second_gap)) { - swap_ranges(&gap, &second_gap); + swap(gap, second_gap); if (sz_range(&second_gap) > sz_range(&first_gap)) - swap_ranges(&second_gap, &first_gap); + swap(second_gap, first_gap); } next: last_vma = vma; @@ -158,7 +148,7 @@ next: /* Sort the two biggest gaps by address */ if (first_gap.start > second_gap.start) - swap_ranges(&first_gap, &second_gap); + swap(first_gap, second_gap); /* Store the result */ regions[0].start = ALIGN(start, DAMON_MIN_REGION); _ Patches currently in -mm which might be from hanyihao@xxxxxxxx are mm-damon-vaddr-remove-swap_ranges-and-replace-it-with-swap.patch