Linux MM tree latest commits
 help / color / mirror / Atom feed
* + mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch added to mm-hotfixes-unstable branch
       [not found] <20261123150049.81317-3-sj@kernel.org>
@ 2026-11-23 17:48 ` Andrew Morton
  2026-12-02  3:47 ` [merged mm-hotfixes-stable] mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch removed from -mm tree Andrew Morton
  1 sibling, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-11-23 17:48 UTC (permalink / raw)
  To: mm-commits, stable, sj, devnexen, evanfengff, akpm


The patch titled
     Subject: mm/damon/core: fix damos_walk() hang with zero watermarks interval
has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
     mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch

This patch will later appear in the mm-hotfixes-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Yifan Feng <evanfengff@gmail.com>
Subject: mm/damon/core: fix damos_walk() hang with zero watermarks interval
Date: Mon, 23 Nov 2026 07:00:47 -0800

kdamond_wait_activation() cancels damos_walk() requests while all
schemes are deactivated by their watermarks.  But it returns without
waiting when the watermarks check interval of a deactivated scheme is
zero, which is the default of the DAMON sysfs interface.  The kdamond
main loop then runs with all schemes deactivated.

In that state, kdamond_apply_schemes() finds no scheme to apply and
returns before it calls damos_walk_complete().  The walk request is
neither completed nor cancelled, so damos_walk() waits until the
watermarks activate a scheme again, possibly forever.

For example, with a scheme that has the free_mem_rate metric, zero
interval_us and a high watermark below the current free memory rate,
writing update_schemes_tried_regions to the kdamond state file never
returns and cannot be killed.  The writer holds damon_sysfs_lock, so all
other DAMON sysfs writes including "off" fail with -EBUSY meanwhile.

Cancel the walk request in kdamond_apply_schemes() when no scheme is
activated, as kdamond_wait_activation() does for a non-zero interval.

Link: https://patch.msgid.link/20261123150049.81317-3-sj@kernel.org
Link: https://lore.kernel.org/20261121025626.75981-1-evanfengff@gmail.com
Fixes: bf0eaba0ff9c ("mm/damon/core: implement damos_walk()")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: SJ Park <sj@kernel.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: David Carlier <devnexen@gmail.com>
Cc: <stable@vger.kernel.org> # 6.14.x

 mm/damon/core.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/mm/damon/core.c~mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval
+++ a/mm/damon/core.c
@@ -3492,9 +3492,13 @@ static noinline_for_stack void kdamond_a
 	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_a
 		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);
_

Patches currently in -mm which might be from evanfengff@gmail.com are

mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch
mm-damon-core-do-not-overwrite-wmarksactivated-in-damos_commit.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [merged mm-hotfixes-stable] mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch removed from -mm tree
       [not found] <20261123150049.81317-3-sj@kernel.org>
  2026-11-23 17:48 ` + mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch added to mm-hotfixes-unstable branch Andrew Morton
@ 2026-12-02  3:47 ` Andrew Morton
  1 sibling, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-12-02  3:47 UTC (permalink / raw)
  To: mm-commits, stable, sj, devnexen, evanfengff, akpm


The quilt patch titled
     Subject: mm/damon/core: fix damos_walk() hang with zero watermarks interval
has been removed from the -mm tree.  Its filename was
     mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Yifan Feng <evanfengff@gmail.com>
Subject: mm/damon/core: fix damos_walk() hang with zero watermarks interval
Date: Mon, 23 Nov 2026 07:00:47 -0800

kdamond_wait_activation() cancels damos_walk() requests while all
schemes are deactivated by their watermarks.  But it returns without
waiting when the watermarks check interval of a deactivated scheme is
zero, which is the default of the DAMON sysfs interface.  The kdamond
main loop then runs with all schemes deactivated.

In that state, kdamond_apply_schemes() finds no scheme to apply and
returns before it calls damos_walk_complete().  The walk request is
neither completed nor cancelled, so damos_walk() waits until the
watermarks activate a scheme again, possibly forever.

For example, with a scheme that has the free_mem_rate metric, zero
interval_us and a high watermark below the current free memory rate,
writing update_schemes_tried_regions to the kdamond state file never
returns and cannot be killed.  The writer holds damon_sysfs_lock, so all
other DAMON sysfs writes including "off" fail with -EBUSY meanwhile.

Cancel the walk request in kdamond_apply_schemes() when no scheme is
activated, as kdamond_wait_activation() does for a non-zero interval.

Link: https://patch.msgid.link/20261123150049.81317-3-sj@kernel.org
Link: https://lore.kernel.org/20261121025626.75981-1-evanfengff@gmail.com
Fixes: bf0eaba0ff9c ("mm/damon/core: implement damos_walk()")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Signed-off-by: SJ Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: SJ Park <sj@kernel.org>
Reviewed-by: SJ Park <sj@kernel.org>
Cc: David Carlier <devnexen@gmail.com>
Cc: <stable@vger.kernel.org> # 6.14.x

 mm/damon/core.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/mm/damon/core.c~mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval
+++ a/mm/damon/core.c
@@ -3492,9 +3492,13 @@ static noinline_for_stack void kdamond_a
 	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_a
 		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);
_

Patches currently in -mm which might be from evanfengff@gmail.com are

tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02  3:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261123150049.81317-3-sj@kernel.org>
2026-11-23 17:48 ` + mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch added to mm-hotfixes-unstable branch Andrew Morton
2026-12-02  3:47 ` [merged mm-hotfixes-stable] mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch removed from -mm tree Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox