Using the 'target_nid' parameter of DAMOS watermark, both DAMON_RECLAIM and DAMON_LRU_SORT modules can set the monitoring range to a specific NUMA memory node. Signed-off-by: Jonghyeon Kim <tome01@xxxxxxxxxx> --- mm/damon/lru_sort.c | 13 +++++++++++++ mm/damon/reclaim.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 3e25a52de..ed136ccba 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -238,6 +238,19 @@ static int damon_lru_sort_apply_parameters(void) damon_set_schemes(ctx, &hot_scheme, 1); damon_add_scheme(ctx, cold_scheme); + /* Set monitoring range from target node */ + if (hot_scheme->wmarks.metric == DAMOS_WMARK_NODE_FREE_MEM_RATE) { + int target_nid = hot_scheme->wmarks.target_nid; + + if (target_nid == NUMA_NO_NODE) + return -EINVAL; + monitor_region_start = PFN_PHYS(node_start_pfn(target_nid)); + monitor_region_end = PFN_PHYS(node_start_pfn(target_nid) + + node_present_pages(target_nid) - 1); + if (monitor_region_end < monitor_region_start) + return -EINVAL; + } + return damon_set_region_biggest_system_ram_default(target, &monitor_region_start, &monitor_region_end); diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index 31b8830a8..9c0c0096b 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -192,6 +192,19 @@ static int damon_reclaim_apply_parameters(void) } damon_set_schemes(ctx, &scheme, 1); + /* Set monitoring range from target node */ + if (scheme->wmarks.metric == DAMOS_WMARK_NODE_FREE_MEM_RATE) { + int target_nid = scheme->wmarks.target_nid; + + if (target_nid == NUMA_NO_NODE) + return -EINVAL; + monitor_region_start = PFN_PHYS(node_start_pfn(target_nid)); + monitor_region_end = PFN_PHYS(node_start_pfn(target_nid) + + node_present_pages(target_nid) - 1); + if (monitor_region_end < monitor_region_start) + return -EINVAL; + } + return damon_set_region_biggest_system_ram_default(target, &monitor_region_start, &monitor_region_end); -- 2.34.1