diff options
author | SeongJae Park <sj@kernel.org> | 2024-02-19 11:44:14 -0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-02-23 17:48:26 -0800 |
commit | c71f8a710c39f8138bdd6abcd922789ebffa2de3 (patch) | |
tree | 04906769058bfcb390be29d474c620caacec8d93 /mm/damon/sysfs-schemes.c | |
parent | 6813131578ecd830c3be9b8a26bc62a2d2027610 (diff) | |
download | linux-c71f8a710c39f8138bdd6abcd922789ebffa2de3.tar.gz linux-c71f8a710c39f8138bdd6abcd922789ebffa2de3.tar.bz2 linux-c71f8a710c39f8138bdd6abcd922789ebffa2de3.zip |
mm/damon/sysfs: implement a kdamond command for updating schemes' effective quotas
Implement yet another kdamond 'state' file input command, namely
'update_schemes_effective_quotas'. If it is written, the
'effective_bytes' files of the kdamond will be updated to provide the
current effective size quota of each scheme in bytes.
Link: https://lkml.kernel.org/r/20240219194431.159606-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/damon/sysfs-schemes.c')
-rw-r--r-- | mm/damon/sysfs-schemes.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index dd46b2db5455..9d90e7b757b7 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1930,6 +1930,26 @@ void damos_sysfs_set_quota_scores(struct damon_sysfs_schemes *sysfs_schemes, } } +void damos_sysfs_update_effective_quotas( + struct damon_sysfs_schemes *sysfs_schemes, + struct damon_ctx *ctx) +{ + struct damos *scheme; + int schemes_idx = 0; + + damon_for_each_scheme(scheme, ctx) { + struct damon_sysfs_quotas *sysfs_quotas; + + /* user could have removed the scheme sysfs dir */ + if (schemes_idx >= sysfs_schemes->nr) + break; + + sysfs_quotas = + sysfs_schemes->schemes_arr[schemes_idx++]->quotas; + sysfs_quotas->effective_sz = scheme->quota.esz; + } +} + static struct damos *damon_sysfs_mk_scheme( struct damon_sysfs_scheme *sysfs_scheme) { |