Skip to content

Commit 1aef9df

Browse files
sjp38akpm00
authored andcommitted
mm/damon/core: commit damos_quota_goal->nid
DAMOS quota goal uses 'nid' field when the metric is DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP. But the goal commit function is not updating the goal's nid field. Fix it. Link: https://lkml.kernel.org/r/[email protected] Fixes: 0e1c773 ("mm/damon/core: introduce damos quota goal metrics for memory node utilization") [6.16.x] Signed-off-by: SeongJae Park <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6ade153 commit 1aef9df

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

mm/damon/core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,19 @@ static struct damos_quota_goal *damos_nth_quota_goal(
754754
return NULL;
755755
}
756756

757+
static void damos_commit_quota_goal_union(
758+
struct damos_quota_goal *dst, struct damos_quota_goal *src)
759+
{
760+
switch (dst->metric) {
761+
case DAMOS_QUOTA_NODE_MEM_USED_BP:
762+
case DAMOS_QUOTA_NODE_MEM_FREE_BP:
763+
dst->nid = src->nid;
764+
break;
765+
default:
766+
break;
767+
}
768+
}
769+
757770
static void damos_commit_quota_goal(
758771
struct damos_quota_goal *dst, struct damos_quota_goal *src)
759772
{
@@ -762,6 +775,7 @@ static void damos_commit_quota_goal(
762775
if (dst->metric == DAMOS_QUOTA_USER_INPUT)
763776
dst->current_value = src->current_value;
764777
/* keep last_psi_total as is, since it will be updated in next cycle */
778+
damos_commit_quota_goal_union(dst, src);
765779
}
766780

767781
/**
@@ -795,6 +809,7 @@ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src)
795809
src_goal->metric, src_goal->target_value);
796810
if (!new_goal)
797811
return -ENOMEM;
812+
damos_commit_quota_goal_union(new_goal, src_goal);
798813
damos_add_quota_goal(dst, new_goal);
799814
}
800815
return 0;

0 commit comments

Comments
 (0)