Re: [PATCH mm-hotfixes-unstable] mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes()
From: SeongJae Park
Date: Tue Nov 22 2022 - 14:54:03 EST
Hi Andrew,
On Tue, 22 Nov 2022 19:48:31 +0000 SeongJae Park <sj@xxxxxxxxxx> wrote:
> Commit da87878010e5 ("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.
>
> Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update")
> Cc: <stable@xxxxxxxxxxxxxxx> # 5.19.y
> Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
This patch is for a hotfix, so based on mm-hotfixes-unstable. And this makes a
following sysfs refactoring patch, "mm/damon/sysfs: split out schemes directory
implementation to separate file" conflicts. Below is the conflict resolved
version of the patch. Please replace it with below one. Sorry for the
inconvenience and thank you for your help in advance!
================================ 8< ===========================================