linux-stable/mm/damon
SeongJae Park 7b3feeb00c mm/damon/reclaim: fix quota stauts loss due to online tunings
commit 1b0ca4e4ff upstream.

Patch series "mm/damon: fix quota status loss due to online tunings".

DAMON_RECLAIM and DAMON_LRU_SORT is not preserving internal quota status
when applying new user parameters, and hence could cause temporal quota
accuracy degradation.  Fix it by preserving the status.


This patch (of 2):

For online parameters change, DAMON_RECLAIM creates new scheme based on
latest values of the parameters and replaces the old scheme with the new
one.  When creating it, the internal status of the quota of the old
scheme is not preserved.  As a result, charging of the quota starts from
zero after the online tuning.  The data that collected to estimate the
throughput of the scheme's action is also reset, and therefore the
estimation should start from the scratch again.  Because the throughput
estimation is being used to convert the time quota to the effective size
quota, this could result in temporal time quota inaccuracy.  It would be
recovered over time, though.  In short, the quota accuracy could be
temporarily degraded after online parameters update.

Fix the problem by checking the case and copying the internal fields for
the status.

Link: https://lkml.kernel.org/r/20240216194025.9207-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20240216194025.9207-2-sj@kernel.org
Fixes: e035c280f6 ("mm/damon/reclaim: 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-01 13:41:47 +01:00
..
core-test.h mm/damon/core-test: fix memory leak in damon_new_ctx() 2023-10-04 10:32:32 -07:00
core.c mm/damon/core: check apply interval in damon_do_apply_schemes() 2024-03-01 13:41:47 +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/core: implement scheme-specific apply interval 2023-10-04 10:32:31 -07:00
Kconfig mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets() 2023-10-25 16:47:15 -07:00
lru_sort.c mm/damon/lru_sort: fix quota status loss due to online tunings 2024-03-01 13:41:47 +01:00
Makefile mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
modules-common.c mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
modules-common.h mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
ops-common.c mm/damon/ops-common: avoid divide-by-zero during region hotness calculation 2023-10-25 16:47:15 -07:00
ops-common.h mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-06-09 16:25:55 -07:00
paddr.c mm/damon/core: use pseudo-moving sum for nr_accesses_bp 2023-10-04 10:32:30 -07:00
reclaim.c mm/damon/reclaim: fix quota stauts loss due to online tunings 2024-03-01 13:41:47 +01:00
sysfs-common.c mm/damon/sysfs: make kobj_type structures constant 2023-02-09 16:51:45 -08:00
sysfs-common.h mm/damon/sysfs: avoid empty scheme tried regions for large apply interval 2023-10-18 14:34:19 -07:00
sysfs-schemes.c mm/damon/sysfs-schemes: fix wrong DAMOS tried regions update timeout setup 2024-02-23 09:51:55 +01:00
sysfs-test.h mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets() 2023-10-25 16:47:15 -07:00
sysfs.c mm/damon/sysfs: check error from damon_sysfs_update_target() 2023-11-15 15:30:09 -08:00
vaddr-test.h mm/damon/vaddr-test: fix memory leak in damon_do_test_apply_three_regions() 2023-09-29 17:20:47 -07:00
vaddr.c mm/damon/core: use pseudo-moving sum for nr_accesses_bp 2023-10-04 10:32:30 -07:00