The patch titled Subject: mm/damon/core: split out scheme stat update logic into a new function has been added to the -mm mm-unstable branch. Its filename is mm-damon-core-split-out-scheme-stat-update-logic-into-a-new-function.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-split-out-scheme-stat-update-logic-into-a-new-function.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: SeongJae Park <sj@xxxxxxxxxx> Subject: mm/damon/core: split out scheme stat update logic into a new function Date: Mon, 24 Oct 2022 20:49:11 +0000 The function for applying a given DAMON scheme action to a given DAMON region, 'damos_apply_scheme()' is not quite short. Make it better to read by splitting out the stat update logic into a new function. Link: https://lkml.kernel.org/r/20221024204919.18524-4-sj@xxxxxxxxxx Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/damon/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/mm/damon/core.c~mm-damon-core-split-out-scheme-stat-update-logic-into-a-new-function +++ a/mm/damon/core.c @@ -755,6 +755,16 @@ static bool damos_skip_charged_region(st return false; } +static void damos_update_stat(struct damos *s, + unsigned long sz_tried, unsigned long sz_applied) +{ + s->stat.nr_tried++; + s->stat.sz_tried += sz_tried; + if (sz_applied) + s->stat.nr_applied++; + s->stat.sz_applied += sz_applied; +} + static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -786,11 +796,7 @@ static void damos_apply_scheme(struct da r->age = 0; update_stat: - s->stat.nr_tried++; - s->stat.sz_tried += sz; - if (sz_applied) - s->stat.nr_applied++; - s->stat.sz_applied += sz_applied; + damos_update_stat(s, sz, sz_applied); } static void damon_do_apply_schemes(struct damon_ctx *c, _ Patches currently in -mm which might be from sj@xxxxxxxxxx are mm-damon-core-split-out-damos-charged-region-skip-logic-into-a-new-function.patch mm-damon-core-split-damos-application-logic-into-a-new-function.patch mm-damon-core-split-out-scheme-stat-update-logic-into-a-new-function.patch mm-damon-core-split-out-scheme-quota-adjustment-logic-into-a-new-function.patch mm-damon-sysfs-use-damon_addr_range-for-regions-start-and-end-values.patch mm-damon-sysfs-remove-parameters-of-damon_sysfs_region_alloc.patch mm-damon-sysfs-move-sysfs_lock-to-common-module.patch mm-damon-sysfs-move-unsigned-long-range-directory-to-common-module.patch mm-damon-sysfs-split-out-kdamond-independent-schemes-stats-update-logic-into-a-new-function.patch mm-damon-modules-deduplicate-init-steps-for-damon-context-setup.patch mm-damon-reclaimlru_sort-remove-unnecessarily-included-headers.patch