The patch titled Subject: mm/damon: move sz_damon_region to damon_sz_region has been added to the -mm mm-unstable branch. Its filename is mm-damon-move-sz_damon_region-to-damon_sz_region.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-move-sz_damon_region-to-damon_sz_region.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> Subject: mm/damon: move sz_damon_region to damon_sz_region Date: Tue, 27 Sep 2022 08:19:45 +0800 Rename sz_damon_region() to damon_sz_region(), and move it to "include/linux/damon.h", because in many places, we can to use this func. Link: https://lkml.kernel.org/r/20220927001946.85375-1-xhao@xxxxxxxxxxxxxxxxx Signed-off-by: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> Suggested-by: SeongJae Park <sj@xxxxxxxxxx> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/damon.h~mm-damon-move-sz_damon_region-to-damon_sz_region +++ a/include/linux/damon.h @@ -484,6 +484,12 @@ static inline struct damon_region *damon return list_first_entry(&t->regions_list, struct damon_region, list); } +static inline unsigned long damon_sz_region(struct damon_region *r) +{ + return r->ar.end - r->ar.start; +} + + #define damon_for_each_region(r, t) \ list_for_each_entry(r, &t->regions_list, list) --- a/mm/damon/core.c~mm-damon-move-sz_damon_region-to-damon_sz_region +++ a/mm/damon/core.c @@ -864,18 +864,13 @@ static void kdamond_apply_schemes(struct } } -static inline unsigned long sz_damon_region(struct damon_region *r) -{ - return r->ar.end - r->ar.start; -} - /* * Merge two adjacent regions into one region */ static void damon_merge_two_regions(struct damon_target *t, struct damon_region *l, struct damon_region *r) { - unsigned long sz_l = sz_damon_region(l), sz_r = sz_damon_region(r); + unsigned long sz_l = damon_sz_region(l), sz_r = damon_sz_region(r); l->nr_accesses = (l->nr_accesses * sz_l + r->nr_accesses * sz_r) / (sz_l + sz_r); @@ -904,7 +899,7 @@ static void damon_merge_regions_of(struc if (prev && prev->ar.end == r->ar.start && abs(prev->nr_accesses - r->nr_accesses) <= thres && - sz_damon_region(prev) + sz_damon_region(r) <= sz_limit) + damon_sz_region(prev) + damon_sz_region(r) <= sz_limit) damon_merge_two_regions(t, prev, r); else prev = r; _ Patches currently in -mm which might be from xhao@xxxxxxxxxxxxxxxxx are mm-damon-simply-damon_ctx-check-in-damon_sysfs_before_terminate.patch mm-damon-remove-duplicate-get_monitoring_region-definitions.patch mm-damon-sysfs-change-few-functions-execute-order.patch mm-damon-simplify-scheme-create-in-damon_lru_sort_apply_parameters.patch mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly.patch mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly-fix.patch mm-damon-simplify-scheme-create-in-lru_sortc.patch mm-damon-sysfs-return-err-value-when-call-kstrtoul-failed.patch mm-hugetlb-add-available_huge_pages-func.patch mm-damon-move-sz_damon_region-to-damon_sz_region.patch mm-damon-use-damon_sz_region-in-appropriate-place.patch