Commit bc72267b authored by Xin Hao's avatar Xin Hao Committed by Zhong Jinghua
Browse files

mm/damon/sysfs: avoid call damon_target_has_pid() repeatedly

mainline inclusion
from mainline-v6.2-rc6
commit 871f697b
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6MRUG

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=871f697b494b04f8d78cc090e49b416062d23a10

--------------------------------

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: default avatarXin Hao <xhao@linux.alibaba.com>
Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarZe Zuo <zuoze1@huawei.com>
parent a047b7d9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment