* [PATCH 0/6] mm/damon: Misc cleanups
@ 2021-12-09 13:18 SeongJae Park
0 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2021-12-09 13:18 UTC (permalink / raw)
To: akpm; +Cc: corbet, linux-mm, linux-doc, linux-kernel, SeongJae Park
This patchset contains miscellaneous cleanups for DAMON's macro
functions and documentations.
SeongJae Park (6):
mm/damon: Convert macro functions to static inline functions
Docs/admin-guide/mm/damon/usage: Update for scheme quotas and
watermarks
Docs/admin-guide/mm/damon/usage: Remove redundant information
Docs/admin-guide/mm/damon/usage: Mention tracepoint at the beginning
Docs/admin-guide/mm/damon/usage: Update for kdamond_pid and
(mk|rm)_contexts
mm/damon: Remove a mistakenly added comment for a future feature
Documentation/admin-guide/mm/damon/usage.rst | 224 +++++++++++++++----
include/linux/damon.h | 20 +-
mm/damon/core.c | 5 +-
mm/damon/vaddr.c | 6 +-
4 files changed, 196 insertions(+), 59 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/6] mm/damon: misc cleanups
@ 2025-07-05 17:49 SeongJae Park
2025-07-05 17:49 ` [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix SeongJae Park
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, kernel-team, linux-doc,
linux-kernel, linux-mm
Yet another round of miscellaneous DAMON cleanups.
SeongJae Park (6):
samples/damon/wsse: rename to have damon_sample_ prefix
samples/damon/prcl: rename to have damon_sample_ prefix
samples/damon/mtier: rename to have damon_sample_ prefix
mm/damon/sysfs: use DAMON core API damon_is_running()
mm/damon/sysfs: don't hold kdamond_lock in before_terminate()
Docs/mm/damon/maintainer-profile: update for mm-new tree
Documentation/mm/damon/maintainer-profile.rst | 35 ++++++++++---------
include/linux/damon.h | 1 +
mm/damon/core.c | 8 ++++-
mm/damon/sysfs.c | 16 ++-------
samples/damon/mtier.c | 5 +++
samples/damon/prcl.c | 5 +++
samples/damon/wsse.c | 5 +++
7 files changed, 44 insertions(+), 31 deletions(-)
base-commit: 486593f91f44f469c920e73a4ef451d9bbbf400e
--
2.39.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
@ 2025-07-05 17:49 ` SeongJae Park
2025-07-05 17:49 ` [PATCH 2/6] samples/damon/prcl: " SeongJae Park
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
DAMON sample module, wsse has its name 'wsse'. It could conflict with
future modules, and not very easy to identify it by name. Use a prefix,
"damon_sample_" for the name.
Note that this could break users if they depend on the old name. But it
is just a sample, so no such usage is expected, or known. Even if such
usage exists, updating it for the new name should be straightforward.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
samples/damon/wsse.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/samples/damon/wsse.c b/samples/damon/wsse.c
index e20238a249e7..1e8969a0a626 100644
--- a/samples/damon/wsse.c
+++ b/samples/damon/wsse.c
@@ -12,6 +12,11 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#ifdef MODULE_PARAM_PREFIX
+#undef MODULE_PARAM_PREFIX
+#endif
+#define MODULE_PARAM_PREFIX "damon_sample_wsse."
+
static int target_pid __read_mostly;
module_param(target_pid, int, 0600);
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] samples/damon/prcl: rename to have damon_sample_ prefix
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
2025-07-05 17:49 ` [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix SeongJae Park
@ 2025-07-05 17:49 ` SeongJae Park
2025-07-05 17:49 ` [PATCH 3/6] samples/damon/mtier: " SeongJae Park
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
DAMON sample module, prcl has its name 'prcl'. It could conflict with
future modules, and not very easy to identify it by name. Use a prefix,
"damon_sample_" for the name.
Note that this could break users if they depend on the old name. But it
is just a sample, so no such usage is expected, or known. Even if such
usage exists, updating it for the new name should be straightforward.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
samples/damon/prcl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/samples/damon/prcl.c b/samples/damon/prcl.c
index 5597e6a08ab2..447ccba09e8a 100644
--- a/samples/damon/prcl.c
+++ b/samples/damon/prcl.c
@@ -11,6 +11,11 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#ifdef MODULE_PARAM_PREFIX
+#undef MODULE_PARAM_PREFIX
+#endif
+#define MODULE_PARAM_PREFIX "damon_sample_prcl."
+
static int target_pid __read_mostly;
module_param(target_pid, int, 0600);
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] samples/damon/mtier: rename to have damon_sample_ prefix
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
2025-07-05 17:49 ` [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix SeongJae Park
2025-07-05 17:49 ` [PATCH 2/6] samples/damon/prcl: " SeongJae Park
@ 2025-07-05 17:49 ` SeongJae Park
2025-07-05 17:49 ` [PATCH 4/6] mm/damon/sysfs: use DAMON core API damon_is_running() SeongJae Park
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
DAMON sample module, mtier has its name 'mtier'. It could conflict with
future modules, and not very easy to identify it by name. Use a prefix,
"damon_sample_" for the name.
Note that this could break users if they depend on the old name. But it
is just a sample, so no such usage is expected, or known. Even if such
usage exists, updating it for the new name should be straightforward.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
samples/damon/mtier.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/samples/damon/mtier.c b/samples/damon/mtier.c
index 97892ade7f31..af168e887f73 100644
--- a/samples/damon/mtier.c
+++ b/samples/damon/mtier.c
@@ -12,6 +12,11 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#ifdef MODULE_PARAM_PREFIX
+#undef MODULE_PARAM_PREFIX
+#endif
+#define MODULE_PARAM_PREFIX "damon_sample_mtier."
+
static unsigned long node0_start_addr __read_mostly;
module_param(node0_start_addr, ulong, 0600);
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] mm/damon/sysfs: use DAMON core API damon_is_running()
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
` (2 preceding siblings ...)
2025-07-05 17:49 ` [PATCH 3/6] samples/damon/mtier: " SeongJae Park
@ 2025-07-05 17:49 ` SeongJae Park
2025-07-05 17:49 ` [PATCH 5/6] mm/damon/sysfs: don't hold kdamond_lock in before_terminate() SeongJae Park
2025-07-05 17:50 ` [PATCH 6/6] Docs/mm/damon/maintainer-profile: update for mm-new tree SeongJae Park
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
DAMON core implements a static function to see if a given DAMON context
is running. DAMON sysfs interface is implementing the same one on its
own. Make the core function non-static and reuse it from the DAMON
sysfs interface.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 1 +
mm/damon/core.c | 8 +++++++-
mm/damon/sysfs.c | 14 ++------------
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index bb58e36f019e..e1fea3119538 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -934,6 +934,7 @@ static inline unsigned int damon_max_nr_accesses(const struct damon_attrs *attrs
int damon_start(struct damon_ctx **ctxs, int nr_ctxs, bool exclusive);
int damon_stop(struct damon_ctx **ctxs, int nr_ctxs);
+bool damon_is_running(struct damon_ctx *ctx);
int damon_call(struct damon_ctx *ctx, struct damon_call_control *control);
int damos_walk(struct damon_ctx *ctx, struct damos_walk_control *control);
diff --git a/mm/damon/core.c b/mm/damon/core.c
index dc0ee2dd55d3..5357a18066b0 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1311,7 +1311,13 @@ int damon_stop(struct damon_ctx **ctxs, int nr_ctxs)
return err;
}
-static bool damon_is_running(struct damon_ctx *ctx)
+/**
+ * damon_is_running() - Returns if a given DAMON context is running.
+ * @ctx: The DAMON context to see if running.
+ *
+ * Return: true if @ctx is running, false otherwise.
+ */
+bool damon_is_running(struct damon_ctx *ctx)
{
bool running;
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 1b1476b79cdb..79d65dcc9dd0 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1189,16 +1189,6 @@ static void damon_sysfs_kdamond_rm_dirs(struct damon_sysfs_kdamond *kdamond)
kobject_put(&kdamond->contexts->kobj);
}
-static bool damon_sysfs_ctx_running(struct damon_ctx *ctx)
-{
- bool running;
-
- mutex_lock(&ctx->kdamond_lock);
- running = ctx->kdamond != NULL;
- mutex_unlock(&ctx->kdamond_lock);
- return running;
-}
-
/*
* enum damon_sysfs_cmd - Commands for a specific kdamond.
*/
@@ -1275,7 +1265,7 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
if (!ctx)
running = false;
else
- running = damon_sysfs_ctx_running(ctx);
+ running = damon_is_running(ctx);
return sysfs_emit(buf, "%s\n", running ?
damon_sysfs_cmd_strs[DAMON_SYSFS_CMD_ON] :
@@ -1429,7 +1419,7 @@ static inline bool damon_sysfs_kdamond_running(
struct damon_sysfs_kdamond *kdamond)
{
return kdamond->damon_ctx &&
- damon_sysfs_ctx_running(kdamond->damon_ctx);
+ damon_is_running(kdamond->damon_ctx);
}
static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] mm/damon/sysfs: don't hold kdamond_lock in before_terminate()
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
` (3 preceding siblings ...)
2025-07-05 17:49 ` [PATCH 4/6] mm/damon/sysfs: use DAMON core API damon_is_running() SeongJae Park
@ 2025-07-05 17:49 ` SeongJae Park
2025-07-05 17:50 ` [PATCH 6/6] Docs/mm/damon/maintainer-profile: update for mm-new tree SeongJae Park
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, kernel-team, linux-kernel, linux-mm
damon_sysfs_before_terminate() is a DAMON callback that is executed from
the kdamond's context. Hence it is safe to access DAMON context
internal data. But the function is unnecessarily holding kdamond_lock
of the context. It is just unnecessary. Remove the locking code.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 79d65dcc9dd0..c0193de6fb9a 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1387,12 +1387,10 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
if (!damon_target_has_pid(ctx))
return;
- mutex_lock(&ctx->kdamond_lock);
damon_for_each_target_safe(t, next, ctx) {
put_pid(t->pid);
damon_destroy_target(t);
}
- mutex_unlock(&ctx->kdamond_lock);
}
/*
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] Docs/mm/damon/maintainer-profile: update for mm-new tree
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
` (4 preceding siblings ...)
2025-07-05 17:49 ` [PATCH 5/6] mm/damon/sysfs: don't hold kdamond_lock in before_terminate() SeongJae Park
@ 2025-07-05 17:50 ` SeongJae Park
5 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2025-07-05 17:50 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Jonathan Corbet, damon, kernel-team, linux-doc,
linux-kernel, linux-mm
Recently a new mm tree for new patches, namely mm-new, has been added.
Update DAMON maintainer's profile doc for DAMON patches life cycle,
which depend on those of mm trees.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
Documentation/mm/damon/maintainer-profile.rst | 35 ++++++++++---------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/Documentation/mm/damon/maintainer-profile.rst b/Documentation/mm/damon/maintainer-profile.rst
index ce3e98458339..5cd07905a193 100644
--- a/Documentation/mm/damon/maintainer-profile.rst
+++ b/Documentation/mm/damon/maintainer-profile.rst
@@ -7,9 +7,9 @@ The DAMON subsystem covers the files that are listed in 'DATA ACCESS MONITOR'
section of 'MAINTAINERS' file.
The mailing lists for the subsystem are damon@lists.linux.dev and
-linux-mm@kvack.org. Patches should be made against the `mm-unstable tree
-<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ whenever possible and posted
-to the mailing lists.
+linux-mm@kvack.org. Patches should be made against the `mm-new tree
+<https://git.kernel.org/akpm/mm/h/mm-new>`_ whenever possible and posted to the
+mailing lists.
SCM Trees
---------
@@ -17,17 +17,19 @@ SCM Trees
There are multiple Linux trees for DAMON development. Patches under
development or testing are queued in `damon/next
<https://git.kernel.org/sj/h/damon/next>`_ by the DAMON maintainer.
-Sufficiently reviewed patches will be queued in `mm-unstable
-<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ by the memory management
-subsystem maintainer. After more sufficient tests, the patches will be queued
-in `mm-stable <https://git.kernel.org/akpm/mm/h/mm-stable>`_, and finally
-pull-requested to the mainline by the memory management subsystem maintainer.
-
-Note again the patches for `mm-unstable tree
-<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ are queued by the memory
-management subsystem maintainer. If the patches requires some patches in
-`damon/next tree <https://git.kernel.org/sj/h/damon/next>`_ which not yet merged
-in mm-unstable, please make sure the requirement is clearly specified.
+Sufficiently reviewed patches will be queued in `mm-new
+<https://git.kernel.org/akpm/mm/h/mm-new>`_ by the memory management subsystem
+maintainer. As more sufficient tests are done, the patches will move to
+`mm-unstable <https://git.kernel.org/akpm/mm/h/mm-unstable>`_ and then to
+`mm-stable <https://git.kernel.org/akpm/mm/h/mm-stable>`_. And finally those
+will be pull-requested to the mainline by the memory management subsystem
+maintainer.
+
+Note again the patches for `mm-new tree
+<https://git.kernel.org/akpm/mm/h/mm-new>`_ are queued by the memory management
+subsystem maintainer. If the patches requires some patches in `damon/next tree
+<https://git.kernel.org/sj/h/damon/next>`_ which not yet merged in mm-new,
+please make sure the requirement is clearly specified.
Submit checklist addendum
-------------------------
@@ -53,8 +55,9 @@ Further doing below and putting the results will be helpful.
Key cycle dates
---------------
-Patches can be sent anytime. Key cycle dates of the `mm-unstable
-<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ and `mm-stable
+Patches can be sent anytime. Key cycle dates of the `mm-new
+<https://git.kernel.org/akpm/mm/h/mm-new>`_, `mm-unstable
+<https://git.kernel.org/akpm/mm/h/mm-unstable>`_and `mm-stable
<https://git.kernel.org/akpm/mm/h/mm-stable>`_ trees depend on the memory
management subsystem maintainer.
--
2.39.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-07-05 17:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
2025-07-05 17:49 ` [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix SeongJae Park
2025-07-05 17:49 ` [PATCH 2/6] samples/damon/prcl: " SeongJae Park
2025-07-05 17:49 ` [PATCH 3/6] samples/damon/mtier: " SeongJae Park
2025-07-05 17:49 ` [PATCH 4/6] mm/damon/sysfs: use DAMON core API damon_is_running() SeongJae Park
2025-07-05 17:49 ` [PATCH 5/6] mm/damon/sysfs: don't hold kdamond_lock in before_terminate() SeongJae Park
2025-07-05 17:50 ` [PATCH 6/6] Docs/mm/damon/maintainer-profile: update for mm-new tree SeongJae Park
-- strict thread matches above, loose matches on Subject: below --
2021-12-09 13:18 [PATCH 0/6] mm/damon: Misc cleanups SeongJae Park
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.