]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/sysfs: avoid call damon_target_has_pid() repeatedly
authorXin Hao <xhao@linux.alibaba.com>
Thu, 15 Sep 2022 14:22:36 +0000 (22:22 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:26 +0000 (14:03 -0700)
commit083027bda1a91e1ece2876ebba40872517af358c
tree51e7a0531609eadf3b74c5d899bf6394900e6072
parent3465d817e3b6adbe413e39951fcb9868515b6c68
mm/damon/sysfs: avoid call damon_target_has_pid() repeatedly

In damon_sysfs_destroy_targets(), we call damon_target_has_pid() to check
whether the 'ctx' include a valid pid, but there no need to call
damon_target_has_pid() to check repeatedly, just need call it once.

[xhao@linux.alibaba.com: more simplified code calls damon_target_has_pid()]
Link: https://lkml.kernel.org/r/20220916133535.7428-1-xhao@linux.alibaba.com
Link: https://lkml.kernel.org/r/20220915142237.92529-1-xhao@linux.alibaba.com
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs.c