The patch titled Subject: mm/damon/core: use abs() instead of diff_of() has been added to the -mm tree. Its filename is mm-damon-core-using-function-abs-instead-of-diff_of.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-damon-core-using-function-abs-instead-of-diff_of.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-damon-core-using-function-abs-instead-of-diff_of.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: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> Subject: mm/damon/core: use abs() instead of diff_of() In kernel, we can use abs(a - b) to get the absolute value, So there is no need to redefine a new one. Link: https://lkml.kernel.org/r/b24e7b82d9efa90daf150d62dea171e19390ad0b.1636989871.git.xhao@xxxxxxxxxxxxxxxxx Signed-off-by: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/damon/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/mm/damon/core.c~mm-damon-core-using-function-abs-instead-of-diff_of +++ a/mm/damon/core.c @@ -757,8 +757,6 @@ static void damon_merge_two_regions(stru damon_destroy_region(r, t); } -#define diff_of(a, b) (a > b ? a - b : b - a) - /* * Merge adjacent regions having similar access frequencies * @@ -772,13 +770,13 @@ static void damon_merge_regions_of(struc struct damon_region *r, *prev = NULL, *next; damon_for_each_region_safe(r, next, t) { - if (diff_of(r->nr_accesses, r->last_nr_accesses) > thres) + if (abs(r->nr_accesses - r->last_nr_accesses) > thres) r->age = 0; else r->age++; if (prev && prev->ar.end == r->ar.start && - diff_of(prev->nr_accesses, r->nr_accesses) <= thres && + abs(prev->nr_accesses - r->nr_accesses) <= thres && sz_damon_region(prev) + sz_damon_region(r) <= sz_limit) damon_merge_two_regions(t, prev, r); else _ Patches currently in -mm which might be from xhao@xxxxxxxxxxxxxxxxx are mm-damon-unified-access_check-function-naming-rules.patch mm-damon-add-age-of-region-tracepoint-support.patch mm-damon-core-using-function-abs-instead-of-diff_of.patch mm-damon-remove-some-no-need-func-definitions-in-damonh-file.patch