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 2/3] mm/damon/core: do not call damos_walk_control->walk() if walk is completed
Date: Mon, 10 Feb 2025 10:27:35 -0800 [thread overview]
Message-ID: <20250210182737.134994-3-sj@kernel.org> (raw)
In-Reply-To: <20250210182737.134994-1-sj@kernel.org>
damos_walk() invokes callback functions of schemes until all schemes
finishes at least one round of walks. If there are multiple DAMOS
schemes having different apply_interval, the callback functions for
longer apply interval scheme will be called for more than a round of the
walk.
The behavior is different from the document (see damos_walk() kernel-doc
comment), and not useful. Make the behavior be same to the documented
one, by stopping invoking the callback if the walk for the given scheme
is completed.
Fixes: bf0eaba0ff9c ("mm/damon/core: implement damos_walk()")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 1d9025d14d83..4b865b2558d9 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -1453,6 +1453,9 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t,
{
struct damos_walk_control *control;
+ if (s->walk_completed)
+ return;
+
mutex_lock(&ctx->walk_control_lock);
control = ctx->walk_control;
mutex_unlock(&ctx->walk_control_lock);
--
2.39.5
next prev parent reply other threads:[~2025-02-10 18:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 18:27 [PATCH 0/3] mm/damon/core: fix wrong and/or useless damos_walk() behaviors SeongJae Park
2025-02-10 18:27 ` [PATCH 1/3] mm/damon/core: unset damos->walk_completed after confimed set SeongJae Park
2025-02-10 18:27 ` SeongJae Park [this message]
2025-02-10 18:27 ` [PATCH 3/3] mm/damon/core: do damos walking in entire regions granularity 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=20250210182737.134994-3-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