From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>, Shuah Khan <shuah@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] selftests/damon/_damon_sysfs: implement updat_schemes_tried_bytes command
Date: Tue, 12 Dec 2023 19:48:08 +0000 [thread overview]
Message-ID: <20231212194810.54457-4-sj@kernel.org> (raw)
In-Reply-To: <20231212194810.54457-1-sj@kernel.org>
Implement update_schemes_tried_bytes command of DAMON sysfs interface in
_damon_sysfs.py. It is not only making the update, but also read the
updated value from the sysfs interface and store it in the Kdamond
python objects so that the user of the module can easily get the value.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/_damon_sysfs.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index 6b99f87a5f1e..e98cf4b6a4b7 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -76,6 +76,7 @@ class Damos:
# todo: Support quotas, watermarks, stats, tried_regions
idx = None
context = None
+ tried_bytes = None
def __init__(self, action='stat', access_pattern=DamosAccessPattern()):
self.action = action
@@ -284,6 +285,19 @@ class Kdamond:
err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'on')
return err
+ def update_schemes_tried_bytes(self):
+ err = write_file(os.path.join(self.sysfs_dir(), 'state'),
+ 'update_schemes_tried_bytes')
+ if err != None:
+ return err
+ for context in self.contexts:
+ for scheme in context.schemes:
+ content, err = read_file(os.path.join(scheme.sysfs_dir(),
+ 'tried_regions', 'total_bytes'))
+ if err != None:
+ return err
+ scheme.tried_bytes = int(content)
+
class Kdamonds:
kdamonds = []
--
2.34.1
next prev parent reply other threads:[~2023-12-12 19:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 19:48 [PATCH v2 0/5] selftests/damon: add Python-written DAMON functionality tests SeongJae Park
2023-12-12 19:48 ` [PATCH v2 1/5] selftests/damon: implement a python module for test-purpose DAMON sysfs controls SeongJae Park
2023-12-12 19:48 ` [PATCH v2 2/5] selftests/damon/_damon_sysfs: implement kdamonds start function SeongJae Park
2023-12-12 19:48 ` SeongJae Park [this message]
2023-12-12 19:48 ` [PATCH v2 4/5] selftests/damon: add a test for update_schemes_tried_regions sysfs command SeongJae Park
2023-12-12 19:48 ` [PATCH v2 5/5] selftests/damon: add a test for update_schemes_tried_regions hang bug 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=20231212194810.54457-4-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--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