]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs...
authorSeongJae Park <sj@kernel.org>
Tue, 22 Nov 2022 19:48:31 +0000 (19:48 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 22:49:41 +0000 (14:49 -0800)
commitc3b68d89e10c66182a8125457b27063caad86624
tree7fc2cb9389cc4ac5815d4d20ed1807640d84d002
parent42a3a7dad1af4445adc2d6112e28768f4afdadf8
mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes()

Commit 74b8d2722d5c ("mm/damon/sysfs: support online inputs update") made
'damon_sysfs_set_schemes()' to be called for running DAMON context, which
could have schemes.  In the case, DAMON sysfs interface is supposed to
update, remove, or add schemes to reflect the sysfs files.  However, the
code is assuming the DAMON context wouldn't have schemes at all, and
therefore creates and adds new schemes.  As a result, the code doesn't
work as intended for online schemes tuning and could have more than
expected memory footprint.  The schemes are all in the DAMON context, so
it doesn't leak the memory, though.

Remove the wrong asssumption (the DAMON context wouldn't have schemes) in
'damon_sysfs_set_schemes()' to fix the bug.

Link: https://lkml.kernel.org/r/20221122194831.3472-1-sj@kernel.org
Fixes: 74b8d2722d5c ("mm/damon/sysfs: support online inputs update")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> [5.19+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs.c