Skip to content

Commit 311f34f

Browse files
sjp38akpm00
authored andcommitted
mm/damon/sysfs: remove damon_sysfs_cmd_request_callback() and its callers
damon_sysfs_cmd_request_callback() is the damon_callback hook functions that were used to handle user requests that need to read and/or write DAMON internal data. All the usages are now updated to use damon_call() or damos_walk(), though. Remove it and its callers. Link: https://lkml.kernel.org/r/20250306175908.66300-7-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 8b40db0 commit 311f34f

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

mm/damon/sysfs.c

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,65 +1529,6 @@ static int damon_sysfs_upd_tuned_intervals(void *data)
15291529
return 0;
15301530
}
15311531

1532-
/*
1533-
* damon_sysfs_cmd_request_callback() - DAMON callback for handling requests.
1534-
* @c: The DAMON context of the callback.
1535-
* @active: Whether @c is not deactivated due to watermarks.
1536-
* @after_aggr: Whether this is called from after_aggregation() callback.
1537-
*
1538-
* This function is periodically called back from the kdamond thread for @c.
1539-
* Then, it checks if there is a waiting DAMON sysfs request and handles it.
1540-
*/
1541-
static int damon_sysfs_cmd_request_callback(struct damon_ctx *c, bool active,
1542-
bool after_aggregation)
1543-
{
1544-
struct damon_sysfs_kdamond *kdamond;
1545-
int err = 0;
1546-
1547-
/* avoid deadlock due to concurrent state_store('off') */
1548-
if (!mutex_trylock(&damon_sysfs_lock))
1549-
return 0;
1550-
kdamond = damon_sysfs_cmd_request.kdamond;
1551-
if (!kdamond || kdamond->damon_ctx != c)
1552-
goto out;
1553-
switch (damon_sysfs_cmd_request.cmd) {
1554-
default:
1555-
break;
1556-
}
1557-
/* Mark the request as invalid now. */
1558-
damon_sysfs_cmd_request.kdamond = NULL;
1559-
out:
1560-
mutex_unlock(&damon_sysfs_lock);
1561-
return err;
1562-
}
1563-
1564-
static int damon_sysfs_after_wmarks_check(struct damon_ctx *c)
1565-
{
1566-
/*
1567-
* after_wmarks_check() is called back while the context is deactivated
1568-
* by watermarks.
1569-
*/
1570-
return damon_sysfs_cmd_request_callback(c, false, false);
1571-
}
1572-
1573-
static int damon_sysfs_after_sampling(struct damon_ctx *c)
1574-
{
1575-
/*
1576-
* after_sampling() is called back only while the context is not
1577-
* deactivated by watermarks.
1578-
*/
1579-
return damon_sysfs_cmd_request_callback(c, true, false);
1580-
}
1581-
1582-
static int damon_sysfs_after_aggregation(struct damon_ctx *c)
1583-
{
1584-
/*
1585-
* after_aggregation() is called back only while the context is not
1586-
* deactivated by watermarks.
1587-
*/
1588-
return damon_sysfs_cmd_request_callback(c, true, true);
1589-
}
1590-
15911532
static struct damon_ctx *damon_sysfs_build_ctx(
15921533
struct damon_sysfs_context *sys_ctx)
15931534
{
@@ -1603,9 +1544,6 @@ static struct damon_ctx *damon_sysfs_build_ctx(
16031544
return ERR_PTR(err);
16041545
}
16051546

1606-
ctx->callback.after_wmarks_check = damon_sysfs_after_wmarks_check;
1607-
ctx->callback.after_sampling = damon_sysfs_after_sampling;
1608-
ctx->callback.after_aggregation = damon_sysfs_after_aggregation;
16091547
ctx->callback.before_terminate = damon_sysfs_before_terminate;
16101548
return ctx;
16111549
}

0 commit comments

Comments
 (0)