diff options
author | SeongJae Park <sj@kernel.org> | 2022-05-10 04:20:55 +0300 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-05-13 17:20:08 +0300 |
commit | 0a890a9faaad3bfb7fa4087c4d35e2ea3527013b (patch) | |
tree | a3ee7e296cce65a76dca9c0e69701be24ebb5620 | |
parent | dae0087aeff4ea7b5054d9612bba1d5f7c3046ec (diff) | |
download | linux-0a890a9faaad3bfb7fa4087c4d35e2ea3527013b.tar.xz |
mm/damon/sysfs: prohibit multiple physical address space monitoring targets
Having multiple targets for physical address space monitoring makes no
sense. This commit prohibits such a ridiculous DAMON context setup my
making the DAMON context build function to check and return an error for
the case.
Link: https://lkml.kernel.org/r/20220429160606.127307-7-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | mm/damon/sysfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index f753bb405101..3d2da791ebd8 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -2125,6 +2125,10 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx, { int i, err; + /* Multiple physical address space monitoring targets makes no sense */ + if (ctx->ops.id == DAMON_OPS_PADDR && sysfs_targets->nr > 1) + return -EINVAL; + for (i = 0; i < sysfs_targets->nr; i++) { struct damon_sysfs_target *sys_target = sysfs_targets->targets_arr[i]; |