The patch titled Subject: mm/damon/vaddr: indicate the target is invalid when 'nr_regions' is zero has been added to the -mm mm-unstable branch. Its filename is mm-damon-vaddr-indicate-the-target-is-invalid-when-nr_regions-is-zero.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-vaddr-indicate-the-target-is-invalid-when-nr_regions-is-zero.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: Kaixu Xia <kaixuxia@xxxxxxxxxxx> Subject: mm/damon/vaddr: indicate the target is invalid when 'nr_regions' is zero Date: Tue, 13 Sep 2022 17:11:27 +0800 When 'init()' and 'update()' DAMON operations failed and the number of the damon_target regions is zero, the kdamond would do nothing to this monitoring target in this case. It makes no sense to run kdamond when all of monitoring targets have no regions. So add the judgement in 'target_valid()' operation to indicate the target is invalid when 'nr_regions' is zero. Link: https://lkml.kernel.org/r/1663060287-30201-5-git-send-email-kaixuxia@xxxxxxxxxxx Signed-off-by: Kaixu Xia <kaixuxia@xxxxxxxxxxx> Cc: SeongJae Park <sj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/damon/vaddr.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/damon/vaddr.c~mm-damon-vaddr-indicate-the-target-is-invalid-when-nr_regions-is-zero +++ a/mm/damon/vaddr.c @@ -598,6 +598,9 @@ static bool damon_va_target_valid(void * struct damon_target *t = target; struct task_struct *task; + if (!damon_nr_regions(t)) + return false; + task = damon_get_task_struct(t); if (task) { put_task_struct(task); _ Patches currently in -mm which might be from kaixuxia@xxxxxxxxxxx are mm-damon-sysfs-simplify-the-judgement-whether-kdamonds-are-busy.patch mm-damon-core-iterate-the-regions-list-from-current-point-in-damon_set_regions.patch mm-damon-vaddr-add-a-comment-for-default-case-in-damon_va_apply_scheme.patch mm-damon-sysfs-use-the-wrapper-directly-to-check-if-the-kdamond-is-running.patch mm-damon-simplify-the-parameter-passing-for-prepare_access_checks.patch mm-damon-sysfs-simplify-the-variable-pid-assignment-operation.patch mm-damon-core-simplify-the-kdamond-stop-mechanism-by-removing-done.patch mm-damon-vaddr-indicate-the-target-is-invalid-when-nr_regions-is-zero.patch