Skip to contentSkip to conversation

mm-damon-sysfs-schemes-fix-double-increment-of-nr_regions.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jun 2

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/sysfs-schemes: fix double increment of nr_regions
has been removed from the -mm tree. Its filename was
mm-damon-sysfs-schemes-fix-double-increment-of-nr_regions.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: Vineet Agarwal <[email protected]>
Subject: mm/damon/sysfs-schemes: fix double increment of nr_regions
Date: Tue, 12 May 2026 09:41:57 +0530

damos_sysfs_populate_region_dir() increments sysfs_regions->nr_regions twice when adding a new region: once explicitly before kobject_init_and_add(), and once again through the post-increment used for the kobject name.

As a result, nr_regions no longer matches the actual number of live regions, and region directory names skip numbers (1, 3, 5, ...).

Use the already incremented value for naming instead of incrementing nr_regions a second time.

Fixes 66178e4ec30a ("mm/damon/sysfs: use damos_walk() for update_schemes_tried_{bytes,regions}")

---

 mm/damon/sysfs-schemes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs-schemes.c renamed from mm/damon/sysfs-schemes.c~mm-damon-sysfs-schemes-fix-double-increment-of-nr_regions +1 -1
@@ -2995,7 +2995,7 @@ void damos_sysfs_populate_region_dir(str
 	if (kobject_init_and_add(&region->kobj,
 				&damon_sysfs_scheme_region_ktype,
 				&sysfs_regions->kobj, "%d",
-				sysfs_regions->nr_regions++)) {
+				sysfs_regions->nr_regions)) {
 		kobject_put(&region->kobj);
 		return;
 	}

_

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