linux-stable/mm/damon
SeongJae Park f98d1f2a36 mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes()
[ Upstream commit 95bc35f9be ]

Commit da87878010 ("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: da87878010 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-08 11:30:21 +01:00
..
core-test.h mm/damon/core-test: add a kunit test case for ops registration 2022-04-29 14:37:00 -07:00
core.c mm/damon: introduce struct damos_access_pattern 2022-12-08 11:30:21 +01:00
dbgfs-test.h mm/damon/dbgfs-test: fix is_target_id() change 2022-03-22 15:57:12 -07:00
dbgfs.c mm/damon: introduce struct damos_access_pattern 2022-12-08 11:30:21 +01:00
Kconfig mm/damon: introduce DAMON-based LRU-lists Sorting 2022-07-03 18:08:43 -07:00
lru_sort.c mm/damon: introduce struct damos_access_pattern 2022-12-08 11:30:21 +01:00
Makefile mm/damon: introduce DAMON-based LRU-lists Sorting 2022-07-03 18:08:43 -07:00
ops-common.c mm/damon/schemes: add 'LRU_PRIO' DAMOS action 2022-07-03 18:08:42 -07:00
ops-common.h mm/damon/schemes: add 'LRU_PRIO' DAMOS action 2022-07-03 18:08:42 -07:00
paddr.c mm/damon/schemes: add 'LRU_DEPRIO' action 2022-07-03 18:08:43 -07:00
reclaim.c mm/damon: introduce struct damos_access_pattern 2022-12-08 11:30:21 +01:00
sysfs.c mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes() 2022-12-08 11:30:21 +01:00
vaddr-test.h mm/damon/vaddr: remove damon_va_apply_three_regions() 2022-05-13 07:20:08 -07:00
vaddr.c mm/damon: validate if the pmd entry is present before accessing 2022-10-21 12:37:42 +02:00