[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220429160606.127307-7-sj@kernel.org>
Date: Fri, 29 Apr 2022 16:05:58 +0000
From: sj@...nel.org
To: akpm@...ux-foundation.org
Cc: linux-damon@...zon.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, SeongJae Park <sj@...nel.org>
Subject: [PATCH 06/14] mm/damon/sysfs: prohibit multiple physical address space monitoring targets
From: SeongJae Park <sj@...nel.org>
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.
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/damon/sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 767ab8c33e4d..988247d35862 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -2124,6 +2124,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];
--
2.25.1
Powered by blists - more mailing lists