Skip to content

Commit 1b0ca4e

Browse files
sjp38akpm00
authored andcommitted
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/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: e035c28 ("mm/damon/reclaim: support online inputs update") Signed-off-by: SeongJae Park <[email protected]> Cc: <[email protected]> [5.19+] Signed-off-by: Andrew Morton <[email protected]>
1 parent 379c5aa commit 1b0ca4e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

mm/damon/reclaim.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,20 @@ static struct damos *damon_reclaim_new_scheme(void)
150150
&damon_reclaim_wmarks);
151151
}
152152

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+
153164
static int damon_reclaim_apply_parameters(void)
154165
{
155-
struct damos *scheme;
166+
struct damos *scheme, *old_scheme;
156167
struct damos_filter *filter;
157168
int err = 0;
158169

@@ -164,6 +175,11 @@ static int damon_reclaim_apply_parameters(void)
164175
scheme = damon_reclaim_new_scheme();
165176
if (!scheme)
166177
return -ENOMEM;
178+
if (!list_empty(&ctx->schemes)) {
179+
damon_for_each_scheme(old_scheme, ctx)
180+
damon_reclaim_copy_quota_status(&scheme->quota,
181+
&old_scheme->quota);
182+
}
167183
if (skip_anon) {
168184
filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true);
169185
if (!filter) {

0 commit comments

Comments
 (0)