diff options
| author | Vineet Agarwal <agarwal.vineet2006@gmail.com> | 2026-05-12 09:41:57 +0530 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-05-28 21:30:58 -0700 |
| commit | f7e42395b195ec413fb2bf2a81985491374a00a1 (patch) | |
| tree | dfbce536f246663874af638fe1cf11cc711d58ac | |
| parent | e942f710f78d36072175378b9ec34b50356f694b (diff) | |
| download | linux-next-history-f7e42395b195ec413fb2bf2a81985491374a00a1.tar.gz | |
mm/damon/sysfs-schemes: fix double increment of nr_regions
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.
Link: https://lore.kernel.org/20260512041157.109845-1-agarwal.vineet2006@gmail.com
Fixes: 66178e4ec30a ("mm/damon/sysfs: use damos_walk() for update_schemes_tried_{bytes,regions}")
Signed-off-by: Vineet Agarwal <agarwal.vineet2006@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
| -rw-r--r-- | mm/damon/sysfs-schemes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index ab2153fff9a83..0d3021db0b99b 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -2995,7 +2995,7 @@ void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes, if (kobject_init_and_add(®ion->kobj, &damon_sysfs_scheme_region_ktype, &sysfs_regions->kobj, "%d", - sysfs_regions->nr_regions++)) { + sysfs_regions->nr_regions)) { kobject_put(®ion->kobj); return; } |
