From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 5/6] mm/damon/sysfs: don't hold kdamond_lock in before_terminate()
Date: Sat, 5 Jul 2025 10:49:59 -0700 [thread overview]
Message-ID: <20250705175000.56259-6-sj@kernel.org> (raw)
In-Reply-To: <20250705175000.56259-1-sj@kernel.org>
damon_sysfs_before_terminate() is a DAMON callback that is executed from
the kdamond's context. Hence it is safe to access DAMON context
internal data. But the function is unnecessarily holding kdamond_lock
of the context. It is just unnecessary. Remove the locking code.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 79d65dcc9dd0..c0193de6fb9a 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1387,12 +1387,10 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
if (!damon_target_has_pid(ctx))
return;
- mutex_lock(&ctx->kdamond_lock);
damon_for_each_target_safe(t, next, ctx) {
put_pid(t->pid);
damon_destroy_target(t);
}
- mutex_unlock(&ctx->kdamond_lock);
}
/*
--
2.39.5
next prev parent reply other threads:[~2025-07-05 17:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 17:49 [PATCH 0/6] mm/damon: misc cleanups SeongJae Park
2025-07-05 17:49 ` [PATCH 1/6] samples/damon/wsse: rename to have damon_sample_ prefix SeongJae Park
2025-07-05 17:49 ` [PATCH 2/6] samples/damon/prcl: " SeongJae Park
2025-07-05 17:49 ` [PATCH 3/6] samples/damon/mtier: " SeongJae Park
2025-07-05 17:49 ` [PATCH 4/6] mm/damon/sysfs: use DAMON core API damon_is_running() SeongJae Park
2025-07-05 17:49 ` SeongJae Park [this message]
2025-07-05 17:50 ` [PATCH 6/6] Docs/mm/damon/maintainer-profile: update for mm-new tree 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=20250705175000.56259-6-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.com \
--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;
as well as URLs for NNTP newsgroup(s).