mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00
mm/damon/sysfs: implement a command to update auto-tuned monitoring intervals
DAMON kernel API callers can show auto-tuned sampling and aggregation intervals from the monmitoring attributes data structure. That can be useful for debugging or tuning of the feature. DAMON user-space ABI users has no way to see that, though. Implement a new DAMON sysfs interface command, namely 'update_tuned_intervals', for the purpose. If the command is written to the kdamond state file, the tuned sampling and aggregation intervals will be updated to the corresponding sysfs interface files. Link: https://lkml.kernel.org/r/20250303221726.484227-6-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
0622c68d0a
commit
1077605396
@ -1213,6 +1213,11 @@ enum damon_sysfs_cmd {
|
||||
* effective size quota of the scheme in bytes.
|
||||
*/
|
||||
DAMON_SYSFS_CMD_UPDATE_SCHEMES_EFFECTIVE_QUOTAS,
|
||||
/*
|
||||
* @DAMON_SYSFS_CMD_UPDATE_TUNED_INTERVALS: Update the tuned monitoring
|
||||
* intevals.
|
||||
*/
|
||||
DAMON_SYSFS_CMD_UPDATE_TUNED_INTERVALS,
|
||||
/*
|
||||
* @NR_DAMON_SYSFS_CMDS: Total number of DAMON sysfs commands.
|
||||
*/
|
||||
@ -1230,6 +1235,7 @@ static const char * const damon_sysfs_cmd_strs[] = {
|
||||
"update_schemes_tried_regions",
|
||||
"clear_schemes_tried_regions",
|
||||
"update_schemes_effective_quotas",
|
||||
"update_tuned_intervals",
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1502,6 +1508,17 @@ static int damon_sysfs_upd_schemes_effective_quotas(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int damon_sysfs_upd_tuned_intervals(void *data)
|
||||
{
|
||||
struct damon_sysfs_kdamond *kdamond = data;
|
||||
struct damon_ctx *ctx = kdamond->damon_ctx;
|
||||
|
||||
kdamond->contexts->contexts_arr[0]->attrs->intervals->sample_us =
|
||||
ctx->attrs.sample_interval;
|
||||
kdamond->contexts->contexts_arr[0]->attrs->intervals->aggr_us =
|
||||
ctx->attrs.aggr_interval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* damon_sysfs_cmd_request_callback() - DAMON callback for handling requests.
|
||||
@ -1723,6 +1740,9 @@ static int damon_sysfs_handle_cmd(enum damon_sysfs_cmd cmd,
|
||||
return damon_sysfs_damon_call(
|
||||
damon_sysfs_upd_schemes_effective_quotas,
|
||||
kdamond);
|
||||
case DAMON_SYSFS_CMD_UPDATE_TUNED_INTERVALS:
|
||||
return damon_sysfs_damon_call(
|
||||
damon_sysfs_upd_tuned_intervals, kdamond);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user