2022-09-09 20:46:07

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 0/7] mm/damon: minor fixes and cleanups

This patchset contains minor fixes and cleanups for DAMON including

- selftest for a bug we found before (Patch 1),
- fix of region holes in vaddr corner case and a kunit test for it
(Patches 2 and 3), and
- documents/Kconfig updates for title wordsmithing (Patch 4) and more
aggressive DAMON debugfs interface deprecation announcement
(Patches 5-7).

SeongJae Park (7):
selftest/damon: add a test for duplicate context dirs creation
mm/damon/core: avoid holes in newly set monitoring target ranges
mm/damon/core-test: test damon_set_regions
Docs/admin-guide/mm/damon: rename the title of the document
mm/damon/Kconfig: Notify debugfs deprecation plan
Docs/DAMON/start: mention the dependency as sysfs instead of debugfs
Docs/admin-guide/mm/damon/usage: note DAMON debugfs interface
deprecation plan

Documentation/admin-guide/mm/damon/index.rst | 6 ++---
Documentation/admin-guide/mm/damon/start.rst | 13 +++------
Documentation/admin-guide/mm/damon/usage.rst | 5 ++++
mm/damon/Kconfig | 3 +++
mm/damon/core-test.h | 23 ++++++++++++++++
mm/damon/core.c | 24 +++++++++++++++++
tools/testing/selftests/damon/Makefile | 1 +
.../debugfs_duplicate_context_creation.sh | 27 +++++++++++++++++++
8 files changed, 89 insertions(+), 13 deletions(-)
create mode 100644 tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh

--
2.25.1


2022-09-09 20:46:36

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 6/7] Docs/admin-guide/mm/damon/start: mention the dependency as sysfs instead of debugfs

'Getting Started' document of DAMON says DAMON user-space tool, damo[1],
is using DAMON debugfs interface, and therefore it needs to ensure
debugfs is mounted. However, the latest version of the tool is using
DAMON sysfs interface. Moreover, DAMON debugfs interface is going to be
deprecated as announced by commit b18402726bd1
("Docs/admin-guide/mm/damon/usage: document DAMON sysfs interface").

This commit therefore update the document to tell readers about DAMON
sysfs interface dependency instead and never mention about debugfs
interface, which will be deprecated.

[1] https://github.com/awslabs/damo

Signed-off-by: SeongJae Park <[email protected]>
---
Documentation/admin-guide/mm/damon/start.rst | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/Documentation/admin-guide/mm/damon/start.rst b/Documentation/admin-guide/mm/damon/start.rst
index 4d5ca2c46288..9f88afc734da 100644
--- a/Documentation/admin-guide/mm/damon/start.rst
+++ b/Documentation/admin-guide/mm/damon/start.rst
@@ -29,16 +29,9 @@ called DAMON Operator (DAMO). It is available at
https://github.com/awslabs/damo. The examples below assume that ``damo`` is on
your ``$PATH``. It's not mandatory, though.

-Because DAMO is using the debugfs interface (refer to :doc:`usage` for the
-detail) of DAMON, you should ensure debugfs is mounted. Mount it manually as
-below::
-
- # mount -t debugfs none /sys/kernel/debug/
-
-or append the following line to your ``/etc/fstab`` file so that your system
-can automatically mount debugfs upon booting::
-
- debugfs /sys/kernel/debug debugfs defaults 0 0
+Because DAMO is using the sysfs interface (refer to :doc:`usage` for the
+detail) of DAMON, you should ensure :doc:`sysfs </filesystems/sysfs>` is
+mounted.


Recording Data Access Patterns
--
2.25.1

2022-09-09 20:54:09

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 1/7] selftest/damon: add a test for duplicate context dirs creation

Commit d26f60703606 ("mm/damon/dbgfs: avoid duplicate context directory
creation") fixes a bug which could result in memory leak and DAMON
disablement. This commit adds a selftest for verifying the fix and
avoid regression.

Signed-off-by: SeongJae Park <[email protected]>
---
tools/testing/selftests/damon/Makefile | 1 +
.../debugfs_duplicate_context_creation.sh | 27 +++++++++++++++++++
2 files changed, 28 insertions(+)
create mode 100644 tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh

diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile
index 0470c5f3e690..a1fa2eff8192 100644
--- a/tools/testing/selftests/damon/Makefile
+++ b/tools/testing/selftests/damon/Makefile
@@ -6,6 +6,7 @@ TEST_GEN_FILES += huge_count_read_write
TEST_FILES = _chk_dependency.sh _debugfs_common.sh
TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh
TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh
+TEST_PROGS += debugfs_duplicate_context_creation.sh
TEST_PROGS += sysfs.sh

include ../lib.mk
diff --git a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh b/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh
new file mode 100644
index 000000000000..4a76e37ef16b
--- /dev/null
+++ b/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source _debugfs_common.sh
+
+# Test duplicated context creation
+# ================================
+
+if ! echo foo > "$DBGFS/mk_contexts"
+then
+ echo "context creation failed"
+ exit 1
+fi
+
+if echo foo > "$DBGFS/mk_contexts"
+then
+ echo "duplicate context creation success"
+ exit 1
+fi
+
+if ! echo foo > "$DBGFS/rm_contexts"
+then
+ echo "context deletion failed"
+ exit 1
+fi
+
+exit 0
--
2.25.1

2022-09-09 20:54:39

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 4/7] Docs/admin-guide/mm/damon: rename the title of the document

The title of the DAMON document for admin-guide, 'Monitoring Data
Accesses', could confuse readers in some ways. First of all, DAMON is
not the only single way for data access monitoring. And the document is
for not only the data access monitoring but also data access pattern
based memory management optimizations (DAMOS). This commit updates the
title to 'DAMON: Data Access MONitor', which more explicitly explains
what the document describes.

Fixes: c4ba6014aec3 ("Documentation: add documents for DAMON")
Signed-off-by: SeongJae Park <[email protected]>
---
Documentation/admin-guide/mm/damon/index.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/mm/damon/index.rst b/Documentation/admin-guide/mm/damon/index.rst
index 05500042f777..33d37bb2fb4e 100644
--- a/Documentation/admin-guide/mm/damon/index.rst
+++ b/Documentation/admin-guide/mm/damon/index.rst
@@ -1,8 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0

-========================
-Monitoring Data Accesses
-========================
+==========================
+DAMON: Data Access MONitor
+==========================

:doc:`DAMON </mm/damon/index>` allows light-weight data access monitoring.
Using DAMON, users can analyze the memory access patterns of their systems and
--
2.25.1

2022-09-09 20:55:16

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 5/7] mm/damon/Kconfig: Notify debugfs deprecation plan

Commit b18402726bd1 ("Docs/admin-guide/mm/damon/usage: document DAMON
sysfs interface") announced the DAMON debugfs interface deprecation
plan, but it is not so aggressively announced. As the deprecation time
is coming, this commit makes the announce more easy to be found by
adding the note to the config menu of DAMON debugfs interface.

Signed-off-by: SeongJae Park <[email protected]>
---
mm/damon/Kconfig | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig
index 66265e3a9c65..7821fcb3f258 100644
--- a/mm/damon/Kconfig
+++ b/mm/damon/Kconfig
@@ -68,6 +68,9 @@ config DAMON_DBGFS

If unsure, say N.

+ This will be removed after >5.15.y LTS kernel is released, so users
+ should move to the sysfs interface (DAMON_SYSFS).
+
config DAMON_DBGFS_KUNIT_TEST
bool "Test for damon debugfs interface" if !KUNIT_ALL_TESTS
depends on DAMON_DBGFS && KUNIT=y
--
2.25.1