From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH 3/5] mm/damon/lru_sort: use damon_kdamond_pid()
Date: Thu, 15 Jan 2026 07:20:43 -0800 [thread overview]
Message-ID: <20260115152047.68415-4-sj@kernel.org> (raw)
In-Reply-To: <20260115152047.68415-1-sj@kernel.org>
DAMON_LRU_SORT directly uses damon_ctx->kdamond field with manual
synchronization using damon_ctx->kdamond_lock, to get the pid of the
kdamond. Use a new dedicated function for the purpose, namely
damon_kdamond_pid(), since that doesn't require manual and error-prone
synchronization.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/lru_sort.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 8296f984b428..bedb9134d286 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -405,7 +405,9 @@ static int damon_lru_sort_turn(bool on)
err = damon_start(&ctx, 1, true);
if (err)
return err;
- kdamond_pid = ctx->kdamond->pid;
+ kdamond_pid = damon_kdamond_pid(ctx);
+ if (kdamond_pid < 0)
+ return kdamond_pid;
return damon_call(ctx, &call_control);
}
--
2.47.3
next prev parent reply other threads:[~2026-01-15 15:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 15:20 [PATCH 0/5] mm/damon: hide kdamond and kdamond_lock from API callers SeongJae Park
2026-01-15 15:20 ` [PATCH 1/5] mm/damon/core: implement damon_kdamond_pid() SeongJae Park
2026-01-15 15:20 ` [PATCH 2/5] mm/damon/sysfs: use damon_kdamond_pid() SeongJae Park
2026-01-15 15:20 ` SeongJae Park [this message]
2026-01-15 15:20 ` [PATCH 4/5] mm/damon/reclaim: " SeongJae Park
2026-01-15 15:20 ` [PATCH 5/5] mm/damon: hide kdamond and kdamond_lock of damon_ctx 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=20260115152047.68415-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-mm@kvack.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