mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
![SeongJae Park](/assets/img/avatar_default.png)
Using tried_regions/total_bytes file, users can efficiently retrieve the total size of memory regions having specific access pattern. However, DAMON sysfs interface in kernel still populates all the infomration on the tried_regions subdirectories. That means the kernel part overhead for the construction of tried regions directories still exists. To remove the overhead, implement yet another command input for 'state' DAMON sysfs file. Writing the input to the file makes DAMON sysfs interface to update only the total_bytes file. Link: https://lkml.kernel.org/r/20230802213222.109841-3-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
/* 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;
|
|
|
|
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);
|
|
|
|
extern const struct kobj_type damon_sysfs_ul_range_ktype;
|
|
|
|
/*
|
|
* 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);
|
|
|
|
extern const struct kobj_type damon_sysfs_schemes_ktype;
|
|
|
|
int damon_sysfs_set_schemes(struct damon_ctx *ctx,
|
|
struct damon_sysfs_schemes *sysfs_schemes);
|
|
|
|
void damon_sysfs_schemes_update_stats(
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
struct damon_ctx *ctx);
|
|
|
|
int damon_sysfs_schemes_update_regions_start(
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
struct damon_ctx *ctx, bool total_bytes_only);
|
|
|
|
int damon_sysfs_schemes_update_regions_stop(struct damon_ctx *ctx);
|
|
|
|
int damon_sysfs_schemes_clear_regions(
|
|
struct damon_sysfs_schemes *sysfs_schemes,
|
|
struct damon_ctx *ctx);
|