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 7/8] _damon_sysfs: implement commit() for online parameters update
Date: Tue, 25 Jun 2024 11:05:37 -0700 [thread overview]
Message-ID: <20240625180538.73134-8-sj@kernel.org> (raw)
In-Reply-To: <20240625180538.73134-1-sj@kernel.org>
Users can update DAMON parameters while it is running, using 'commit'
DAMON sysfs interface command. For testing the feature in future tests,
implement a function for doing that on the test-purpose DAMON sysfs
interface wrapper Python module.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/_damon_sysfs.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index 17352b9d204d..6e136dc3df19 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -481,6 +481,25 @@ class Kdamond:
goal.effective_bytes = int(content)
return None
+ def commit(self):
+ nr_contexts_file = os.path.join(self.sysfs_dir(),
+ 'contexts', 'nr_contexts')
+ content, err = read_file(nr_contexts_file)
+ if err is not None:
+ return err
+ if int(content) != len(self.contexts):
+ err = write_file(nr_contexts_file, '%d' % len(self.contexts))
+ if err is not None:
+ return err
+
+ for context in self.contexts:
+ err = context.stage()
+ if err is not None:
+ return err
+ err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'commit')
+ return err
+
+
def commit_schemes_quota_goals(self):
for context in self.contexts:
for scheme in context.schemes:
--
2.39.2
next prev parent reply other threads:[~2024-06-25 18:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 18:05 [PATCH 0/8] selftests/damon: test DAMOS tried regions and {min,max}_nr_regions SeongJae Park
2024-06-25 18:05 ` [PATCH 1/8] selftests/damon/access_memory: use user-defined region size SeongJae Park
2024-06-25 18:05 ` [PATCH 2/8] selftests/damon/_damon_sysfs: support schemes_update_tried_regions SeongJae Park
2024-06-25 18:05 ` [PATCH 3/8] selftests/damon: implement a program for even-numbered memory regions access SeongJae Park
2024-06-25 18:05 ` [PATCH 4/8] selftests/damon: implement DAMOS tried regions test SeongJae Park
2024-06-25 18:05 ` [PATCH 5/8] selftests/damon/_damon_sysfs: implement kdamonds stop function SeongJae Park
2024-06-25 18:05 ` [PATCH 6/8] selftests/damon: implement test for min/max_nr_regions SeongJae Park
2024-06-25 18:05 ` SeongJae Park [this message]
2024-06-25 18:05 ` [PATCH 8/8] selftests/damon/damon_nr_regions: test online-tuned max_nr_regions 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=20240625180538.73134-8-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