Skip to content

Commit d682f5f

Browse files
sjp38akpm00
authored andcommitted
mm/damon/sysfs: remove damon_sysfs_cmd_request and its readers
damon_sysfs_cmd_request is DAMON sysfs interface's own synchronization mechanism for accessing DAMON internal data via damon_callback hooks. All the users are now migrated to damon_call() and damos_walk(), so nobody really uses it. No one writes to the data structure but reading code is still remained. Remove the reading code and the entire data structure. Link: https://lkml.kernel.org/r/20250306175908.66300-8-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 311f34f commit d682f5f

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

mm/damon/sysfs.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,25 +1238,6 @@ static const char * const damon_sysfs_cmd_strs[] = {
12381238
"update_tuned_intervals",
12391239
};
12401240

1241-
/*
1242-
* struct damon_sysfs_cmd_request - A request to the DAMON callback.
1243-
* @cmd: The command that needs to be handled by the callback.
1244-
* @kdamond: The kobject wrapper that associated to the kdamond thread.
1245-
*
1246-
* This structure represents a sysfs command request that need to access some
1247-
* DAMON context-internal data. Because DAMON context-internal data can be
1248-
* safely accessed from DAMON callbacks without additional synchronization, the
1249-
* request will be handled by the DAMON callback. None-``NULL`` @kdamond means
1250-
* the request is valid.
1251-
*/
1252-
struct damon_sysfs_cmd_request {
1253-
enum damon_sysfs_cmd cmd;
1254-
struct damon_sysfs_kdamond *kdamond;
1255-
};
1256-
1257-
/* Current DAMON callback request. Protected by damon_sysfs_lock. */
1258-
static struct damon_sysfs_cmd_request damon_sysfs_cmd_request;
1259-
12601241
static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
12611242
char *buf)
12621243
{
@@ -1555,8 +1536,6 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
15551536

15561537
if (damon_sysfs_kdamond_running(kdamond))
15571538
return -EBUSY;
1558-
if (damon_sysfs_cmd_request.kdamond == kdamond)
1559-
return -EBUSY;
15601539
/* TODO: support multiple contexts per kdamond */
15611540
if (kdamond->contexts->nr != 1)
15621541
return -EINVAL;
@@ -1796,8 +1775,7 @@ static bool damon_sysfs_kdamonds_busy(struct damon_sysfs_kdamond **kdamonds,
17961775
int i;
17971776

17981777
for (i = 0; i < nr_kdamonds; i++) {
1799-
if (damon_sysfs_kdamond_running(kdamonds[i]) ||
1800-
damon_sysfs_cmd_request.kdamond == kdamonds[i])
1778+
if (damon_sysfs_kdamond_running(kdamonds[i]))
18011779
return true;
18021780
}
18031781

0 commit comments

Comments
 (0)