From: SeongJae Park Date: Fri, 22 May 2026 15:40:14 +0000 (-0700) Subject: samples/damon/mtier: replace damon_add_region() with damon_set_regions() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd036cc8c384b8593b5020a82b4b73ee3d10e22c;p=thirdparty%2Flinux.git samples/damon/mtier: replace damon_add_region() with damon_set_regions() mtier DAMON sample module and DAMON virtual address operation set (vaddr) unit tests are using damon_add_region() for setup of DAMON monitoring target region boundaries setup. But, damon_set_regions() is designed for exactly the purpose. All other DAMON API callers use the function for the purpose. Replace damon_add_region() usage in mtier sample module with damon_set_regions(), for unifying the use case and reducing the maintenance cost. Link: https://lore.kernel.org/20260522154026.80546-4-sj@kernel.org Signed-off-by: SeongJae Park Cc: Brendan Higgins Cc: Shuah Khan Signed-off-by: Andrew Morton --- diff --git a/samples/damon/mtier.c b/samples/damon/mtier.c index 775838a23d935..eb1143de8df17 100644 --- a/samples/damon/mtier.c +++ b/samples/damon/mtier.c @@ -75,11 +75,11 @@ static struct damon_ctx *damon_sample_mtier_build_ctx(bool promote) struct damon_ctx *ctx; struct damon_attrs attrs; struct damon_target *target; - struct damon_region *region; struct damos *scheme; struct damos_quota_goal *quota_goal; struct damos_filter *filter; struct region_range addr; + struct damon_addr_range range; int ret; ctx = damon_new_ctx(); @@ -120,10 +120,12 @@ static struct damon_ctx *damon_sample_mtier_build_ctx(bool promote) addr.end = promote ? node1_end_addr : node0_end_addr; } - region = damon_new_region(addr.start, addr.end); - if (!region) + range.start = addr.start; + range.end = addr.end; + + ret = damon_set_regions(target, &range, 1, DAMON_MIN_REGION_SZ); + if (ret) goto free_out; - damon_add_region(region, target); scheme = damon_new_scheme( /* access pattern */