diff options
| author | Enze Li <lienze@kylinos.cn> | 2026-08-31 07:26:04 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-06 17:39:15 -0700 |
| commit | ee5a5b0a281339cb590d657ec69971e2627802eb (patch) | |
| tree | ea45f6fedc940b31d921522f32bf1567c5a78dc7 /include/linux | |
| parent | e287e45ab84f5f95859ee8810bebbea9914b73e5 (diff) | |
| download | linux-ee5a5b0a281339cb590d657ec69971e2627802eb.tar.gz linux-ee5a5b0a281339cb590d657ec69971e2627802eb.zip | |
mm/damon/core: introduce damon_set_target_pid()
The logic that finds the struct pid for a given pid number and assigns it
to a damon_target is duplicated in multiple places. Including
damon_sysfs_add_target() of mm/damon/sysfs.c and the start functions of
the two sample modules, samples/damon/wsse.c and samples/damon/prcl.c.
Add a function that does the work, and replace the duplicated code in the
places with calls to the function.
Link: https://lore.kernel.org/20260831142611.77572-3-sj@kernel.org
Signed-off-by: Enze Li <lienze@kylinos.cn>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hari Mishal <harimishal1@gmail.com>
Cc: Jaeyeon Lee <jaeyeon.lee.dev@gmail.com>
Cc: Li Youhong <liyouhong@kylinos.cn>
Cc: Shuah Khan <shuah@kernel.org>
Cc: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
Cc: zhaozhengzhuo <zhaozhengzhuo@uniontech.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/damon.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/damon.h b/include/linux/damon.h index 955b9f614e5b..7b1b6050a828 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -1057,6 +1057,7 @@ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src); struct damon_target *damon_new_target(void); void damon_add_target(struct damon_ctx *ctx, struct damon_target *t); +int damon_set_target_pid(struct damon_target *t, int pid); void damon_free_target(struct damon_target *t); void damon_destroy_target(struct damon_target *t, struct damon_ctx *ctx); unsigned int damon_nr_regions(struct damon_target *t); |
