2022-10-27 06:59:38 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Common Primitives for DAMON Sysfs Interface
|
|
|
|
*
|
|
|
|
* Author: SeongJae Park <sj@kernel.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/damon.h>
|
|
|
|
#include <linux/kobject.h>
|
|
|
|
|
|
|
|
extern struct mutex damon_sysfs_lock;
|
2022-10-27 06:59:39 +08:00
|
|
|
|
|
|
|
struct damon_sysfs_ul_range {
|
|
|
|
struct kobject kobj;
|
|
|
|
unsigned long min;
|
|
|
|
unsigned long max;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct damon_sysfs_ul_range *damon_sysfs_ul_range_alloc(
|
|
|
|
unsigned long min,
|
|
|
|
unsigned long max);
|
|
|
|
void damon_sysfs_ul_range_release(struct kobject *kobj);
|
|
|
|
|
2023-02-08 03:21:15 +08:00
|
|
|
extern const struct kobj_type damon_sysfs_ul_range_ktype;
|
2022-10-27 06:59:41 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* schemes directory
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct damon_sysfs_schemes {
|
|
|
|
struct kobject kobj;
|
|
|
|
struct damon_sysfs_scheme **schemes_arr;
|
|
|
|
int nr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct damon_sysfs_schemes *damon_sysfs_schemes_alloc(void);
|
|
|
|
void damon_sysfs_schemes_rm_dirs(struct damon_sysfs_schemes *schemes);
|
|
|
|
|
2023-02-08 03:21:15 +08:00
|
|
|
extern const struct kobj_type damon_sysfs_schemes_ktype;
|
2022-10-27 06:59:41 +08:00
|
|
|
|
2024-06-19 02:18:05 +08:00
|
|
|
int damon_sysfs_add_schemes(struct damon_ctx *ctx,
|
2022-10-27 06:59:41 +08:00
|
|
|
struct damon_sysfs_schemes *sysfs_schemes);
|
|
|
|
|
|
|
|
void damon_sysfs_schemes_update_stats(
|
|
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
|
|
struct damon_ctx *ctx);
|
2022-11-02 06:03:24 +08:00
|
|
|
|
|
|
|
int damon_sysfs_schemes_update_regions_start(
|
|
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
2023-08-03 05:32:18 +08:00
|
|
|
struct damon_ctx *ctx, bool total_bytes_only);
|
2022-11-02 06:03:24 +08:00
|
|
|
|
2024-02-06 10:51:58 +08:00
|
|
|
void damos_sysfs_mark_finished_regions_updates(struct damon_ctx *ctx);
|
|
|
|
|
2023-10-13 03:22:54 +08:00
|
|
|
bool damos_sysfs_regions_upd_done(void);
|
|
|
|
|
2022-11-02 06:03:24 +08:00
|
|
|
int damon_sysfs_schemes_update_regions_stop(struct damon_ctx *ctx);
|
2022-11-02 06:03:25 +08:00
|
|
|
|
|
|
|
int damon_sysfs_schemes_clear_regions(
|
|
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
|
|
struct damon_ctx *ctx);
|
2023-11-30 10:36:47 +08:00
|
|
|
|
2024-02-20 03:44:20 +08:00
|
|
|
int damos_sysfs_set_quota_scores(struct damon_sysfs_schemes *sysfs_schemes,
|
2023-11-30 10:36:47 +08:00
|
|
|
struct damon_ctx *ctx);
|
2024-02-20 03:44:14 +08:00
|
|
|
|
|
|
|
void damos_sysfs_update_effective_quotas(
|
|
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
|
|
struct damon_ctx *ctx);
|