Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/reclaim: fix quota stauts loss due to online tunings

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: e035c280f6df ("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>

authored by

SeongJae Park and committed by
Andrew Morton
1b0ca4e4 379c5aaa

+17 -1
+17 -1
mm/damon/reclaim.c
··· 150 150 &damon_reclaim_wmarks); 151 151 } 152 152 153 + static void damon_reclaim_copy_quota_status(struct damos_quota *dst, 154 + struct damos_quota *src) 155 + { 156 + dst->total_charged_sz = src->total_charged_sz; 157 + dst->total_charged_ns = src->total_charged_ns; 158 + dst->charged_sz = src->charged_sz; 159 + dst->charged_from = src->charged_from; 160 + dst->charge_target_from = src->charge_target_from; 161 + dst->charge_addr_from = src->charge_addr_from; 162 + } 163 + 153 164 static int damon_reclaim_apply_parameters(void) 154 165 { 155 - struct damos *scheme; 166 + struct damos *scheme, *old_scheme; 156 167 struct damos_filter *filter; 157 168 int err = 0; 158 169 ··· 175 164 scheme = damon_reclaim_new_scheme(); 176 165 if (!scheme) 177 166 return -ENOMEM; 167 + if (!list_empty(&ctx->schemes)) { 168 + damon_for_each_scheme(old_scheme, ctx) 169 + damon_reclaim_copy_quota_status(&scheme->quota, 170 + &old_scheme->quota); 171 + } 178 172 if (skip_anon) { 179 173 filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true); 180 174 if (!filter) {