* [merged mm-stable] mm-damon-core-introduce-damon_set_target_pid.patch removed from -mm tree
@ 2026-10-07 0:51 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-10-07 0:51 UTC (permalink / raw)
To: mm-commits, zhaozhengzhuo, zenghui.yu, sj, shuah, liyouhong,
jaeyeon.lee.dev, harimishal1, gregkh, lienze, akpm
The quilt patch titled
Subject: mm/damon/core: introduce damon_set_target_pid()
has been removed from the -mm tree. Its filename was
mm-damon-core-introduce-damon_set_target_pid.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Enze Li <lienze@kylinos.cn>
Subject: mm/damon/core: introduce damon_set_target_pid()
Date: Mon, 31 Aug 2026 07:26:04 -0700
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>
---
include/linux/damon.h | 1 +
mm/damon/core.c | 12 ++++++++++++
mm/damon/sysfs.c | 6 ++----
samples/damon/prcl.c | 5 +----
samples/damon/wsse.c | 5 +----
5 files changed, 17 insertions(+), 12 deletions(-)
--- a/include/linux/damon.h~mm-damon-core-introduce-damon_set_target_pid
+++ a/include/linux/damon.h
@@ -1057,6 +1057,7 @@ int damos_commit_quota_goals(struct damo
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);
--- a/mm/damon/core.c~mm-damon-core-introduce-damon_set_target_pid
+++ a/mm/damon/core.c
@@ -10,6 +10,7 @@
#include <linux/kthread.h>
#include <linux/memcontrol.h>
#include <linux/mm.h>
+#include <linux/pid.h>
#include <linux/psi.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -795,6 +796,17 @@ void damon_add_target(struct damon_ctx *
list_add_tail(&t->list, &ctx->adaptive_targets);
}
+/*
+ * Assign the struct pid of the given pid number to the given target.
+ */
+int damon_set_target_pid(struct damon_target *t, int pid)
+{
+ t->pid = find_get_pid(pid);
+ if (!t->pid)
+ return -EINVAL;
+ return 0;
+}
+
static void damon_del_target(struct damon_target *t)
{
list_del(&t->list);
--- a/mm/damon/sysfs.c~mm-damon-core-introduce-damon_set_target_pid
+++ a/mm/damon/sysfs.c
@@ -3,7 +3,6 @@
* DAMON sysfs Interface
*/
-#include <linux/pid.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -2035,9 +2034,8 @@ static int damon_sysfs_add_target(struct
return -ENOMEM;
damon_add_target(ctx, t);
if (damon_target_has_pid(ctx)) {
- t->pid = find_get_pid(sys_target->pid);
- if (!t->pid)
- /* caller will destroy targets */
+ /* caller will destroy targets */
+ if (damon_set_target_pid(t, sys_target->pid))
return -EINVAL;
}
t->obsolete = sys_target->obsolete;
--- a/samples/damon/prcl.c~mm-damon-core-introduce-damon_set_target_pid
+++ a/samples/damon/prcl.c
@@ -32,7 +32,6 @@ module_param_cb(enabled, &enabled_param_
MODULE_PARM_DESC(enabled, "Enable or disable DAMON_SAMPLE_PRCL");
static struct damon_ctx *ctx;
-static struct pid *target_pidp;
static int damon_sample_prcl_repeat_call_fn(void *data)
{
@@ -79,12 +78,10 @@ static int damon_sample_prcl_start(void)
return -ENOMEM;
}
damon_add_target(ctx, target);
- target_pidp = find_get_pid(target_pid);
- if (!target_pidp) {
+ if (damon_set_target_pid(target, target_pid)) {
damon_destroy_ctx(ctx);
return -EINVAL;
}
- target->pid = target_pidp;
scheme = damon_new_scheme(
&(struct damos_access_pattern) {
--- a/samples/damon/wsse.c~mm-damon-core-introduce-damon_set_target_pid
+++ a/samples/damon/wsse.c
@@ -33,7 +33,6 @@ module_param_cb(enabled, &enabled_param_
MODULE_PARM_DESC(enabled, "Enable or disable DAMON_SAMPLE_WSSE");
static struct damon_ctx *ctx;
-static struct pid *target_pidp;
static int damon_sample_wsse_repeat_call_fn(void *data)
{
@@ -79,12 +78,10 @@ static int damon_sample_wsse_start(void)
return -ENOMEM;
}
damon_add_target(ctx, target);
- target_pidp = find_get_pid(target_pid);
- if (!target_pidp) {
+ if (damon_set_target_pid(target, target_pid)) {
damon_destroy_ctx(ctx);
return -EINVAL;
}
- target->pid = target_pidp;
err = damon_start(&ctx, 1, true);
if (err) {
_
Patches currently in -mm which might be from lienze@kylinos.cn are
maintainers-cover-all-hugetlb-headers-under-hugetlb-subsystem.patch
mm-hugetlb_cgroup-add-trailing-endif-comment-for-include-guard.patch
docs-hugetlbpagerst-fix-typo-in-per-node-attribute-description.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-07 0:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 0:51 [merged mm-stable] mm-damon-core-introduce-damon_set_target_pid.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.