public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
	Bijan Tabatabai <bijan311@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 6/9] selftests/damon/_damon_sysfs: support obsolete_target file
Date: Wed, 22 Oct 2025 18:25:30 -0700	[thread overview]
Message-ID: <20251023012535.69625-7-sj@kernel.org> (raw)
In-Reply-To: <20251023012535.69625-1-sj@kernel.org>

A DAMON sysfs file, namely obsolete_target, has been newly introduced.
Add a support of that file to _damon_sysfs.py so that DAMON selftests
for the file can be easily written.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 tools/testing/selftests/damon/_damon_sysfs.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index a0e6290833fb..748778b563cd 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -475,12 +475,14 @@ class Damos:
 
 class DamonTarget:
     pid = None
+    obsolete = None
     # todo: Support target regions if test is made
     idx = None
     context = None
 
-    def __init__(self, pid):
+    def __init__(self, pid, obsolete=False):
         self.pid = pid
+        self.obsolete = obsolete
 
     def sysfs_dir(self):
         return os.path.join(
@@ -491,8 +493,13 @@ class DamonTarget:
                 os.path.join(self.sysfs_dir(), 'regions', 'nr_regions'), '0')
         if err is not None:
             return err
-        return write_file(
+        err = write_file(
                 os.path.join(self.sysfs_dir(), 'pid_target'), self.pid)
+        if err is not None:
+            return err
+        return write_file(
+                os.path.join(self.sysfs_dir(), 'obsolete_target'),
+                'Y' if self.obsolete else 'N')
 
 class IntervalsGoal:
     access_bp = None
-- 
2.47.3

  parent reply	other threads:[~2025-10-23  1:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23  1:25 [PATCH 0/9] mm/damon: support pin-point targets removal SeongJae Park
2025-10-23  1:25 ` [PATCH 1/9] mm/damon/core: add damon_target->obsolete for pin-point removal SeongJae Park
2025-10-23  1:25 ` [PATCH 2/9] mm/damon/sysfs: test commit input against realistic destination SeongJae Park
2025-10-23  1:25 ` [PATCH 3/9] mm/damon/sysfs: implement obsolete_target file SeongJae Park
2025-10-23  1:25 ` [PATCH 4/9] Docs/admin-guide/mm/damon/usage: document " SeongJae Park
2025-10-23  1:25 ` [PATCH 5/9] Docs/ABI/damon: document obsolete_target sysfs file SeongJae Park
2025-10-23  1:25 ` SeongJae Park [this message]
2025-10-23  1:25 ` [PATCH 7/9] drgn_dump_damon_status: dump damon_target->obsolete SeongJae Park
2025-10-23  1:25 ` [PATCH 8/9] sysfs.py: extend assert_ctx_committed() for monitoring targets SeongJae Park
2025-10-23  1:25 ` [PATCH 9/9] selftests/damon/sysfs: add obsolete_target test SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251023012535.69625-7-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bijan311@gmail.com \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox