Skip to contentSkip to conversation

mm-damon-core-add-damon_merge_two_regions-debug_sanity-check.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/core: add damon_merge_two_regions() debug_sanity check
has been removed from the -mm tree. Its filename was
mm-damon-core-add-damon_merge_two_regions-debug_sanity-check.patch

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

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon/core: add damon_merge_two_regions() debug_sanity check
Date: Fri, 6 Mar 2026 07:29:08 -0800

A data corruption could cause damon_merge_two_regions() creating zero length DAMON regions. Add a sanity check for that under CONFIG_DAMON_DEBUG_SANITY.

---

 mm/damon/core.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-add-damon_merge_two_regions-debug_sanity-check +16 -0
@@ -2475,6 +2475,21 @@ static void kdamond_apply_schemes(struct
 	mutex_unlock(&c->walk_control_lock);
 }
 
+#ifdef CONFIG_DAMON_DEBUG_SANITY
+static void damon_verify_merge_two_regions(
+		struct damon_region *l, struct damon_region *r)
+{
+	/* damon_merge_two_regions() may created incorrect left region */
+	WARN_ONCE(l->ar.start >= l->ar.end, "l: %lu-%lu, r: %lu-%lu\n",
+			l->ar.start, l->ar.end, r->ar.start, r->ar.end);
+}
+#else
+static void damon_verify_merge_two_regions(
+		struct damon_region *l, struct damon_region *r)
+{
+}
+#endif
+
 /*
  * Merge two adjacent regions into one region
  */
@@ -2488,6 +2503,7 @@ static void damon_merge_two_regions(stru
 	l->nr_accesses_bp = l->nr_accesses * 10000;
 	l->age = (l->age * sz_l + r->age * sz_r) / (sz_l + sz_r);
 	l->ar.end = r->ar.end;
+	damon_verify_merge_two_regions(l, r);
 	damon_destroy_region(r, t);
 }
 

_

Patches currently in -mm which might be from [email protected] are

mm-damon-sysfs-dealloc-repeat_call_control-if-damon_call-fails.patch