From: Yifan Feng <evanfengff@gmail.com>
To: SJ Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mm/damon/core: fix damos_walk() hang with zero watermarks interval
Date: Thu, 19 Nov 2026 16:13:00 -0800 [thread overview]
Message-ID: <20261120001300.11809-1-evanfengff@gmail.com> (raw)
In-Reply-To: <20261119014247.119946-1-sj@kernel.org>
On Wed, 18 Nov 2026 17:42:46 -0800 SJ Park <sj@kernel.org> wrote:
[...]
> But, this could make has_schemes_to_apply has false positive. How about
> calling damos_Walk_cancel() when has_schemes_to_apply is false, like below?
Thanks for the review. You are right about the false positive.
I tried your change. It fixes the hang, but has_schemes_to_apply is also
false whenever no scheme has reached its next_apply_sis yet, so it cancels
the walks of activated schemes too. In my test (one stat scheme, default
intervals) 18 of 20 update_schemes_tried_regions writes got -ECANCELED,
and two selftests fail: sysfs_update_schemes_tried_regions_wss_estimation.py
and sysfs_update_schemes_tried_regions_hang.py.
What do you think about cancelling only when no scheme is activated?
'''
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -3492,9 +3492,13 @@ static noinline_for_stack void kdamond_apply_schemes(struct damon_ctx *c)
struct damon_target *t;
struct damos *s;
bool has_schemes_to_apply = false;
+ bool has_activated_schemes = false;
unsigned long max_region_sz;
damon_for_each_scheme(s, c) {
+ if (s->wmarks.activated)
+ has_activated_schemes = true;
+
if (time_before(c->passed_sample_intervals, s->next_apply_sis))
continue;
@@ -3506,8 +3510,12 @@ static noinline_for_stack void kdamond_apply_schemes(struct damon_ctx *c)
damos_adjust_quota(c, s);
}
- if (!has_schemes_to_apply)
+ if (!has_schemes_to_apply) {
+ /* The walk cannot be completed while no scheme is activated */
+ if (!has_activated_schemes)
+ damos_walk_cancel(c);
return;
+ }
max_region_sz = damon_region_sz_limit(c);
mutex_lock(&c->walk_control_lock);
'''
With this the hang is gone, 20 of 20 writes succeed while the scheme is
activated, and kunit and selftests results are the same as on the base
kernel.
I will send v2 with this if you are ok with it.
Thanks,
Yifan
next prev parent reply other threads:[~2026-11-20 0:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:50 [PATCH] mm/damon/core: fix damos_walk() hang with zero watermarks interval Yifan Feng
2026-11-19 1:42 ` SJ Park
2026-11-20 0:13 ` Yifan Feng [this message]
2026-11-20 0:49 ` SJ 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=20261120001300.11809-1-evanfengff@gmail.com \
--to=evanfengff@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sj@kernel.org \
--cc=stable@vger.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