On Wed, 2 Jul 2025 15:13:30 -0500 Bijan Tabatabai <bijan311@xxxxxxxxx> wrote: > From: Bijan Tabatabai <bijantabatab@xxxxxxxxxx> > > When committing new scheme parameters from the sysfs, copy the > target_nid and migrate_dests of the source schemes into the destination > schemes. Fixing the missed update of target_nid deserves Fixes: and Cc: stable@ in my opinion. Could you please split and post the part as another patch? For the Fixes, I think 83dc7bbaecae ("mm/damon/sysfs: use damon_commit_ctx()") should be appripriate. > > Signed-off-by: Bijan Tabatabai <bijantabatab@xxxxxxxxxx> Assuming my above request is accepted, Reviewed-by: SeongJae Park <sj@xxxxxxxxxx> > --- > mm/damon/core.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/mm/damon/core.c b/mm/damon/core.c > index a4c3cfe531df..0565aae8d1fa 100644 > --- a/mm/damon/core.c > +++ b/mm/damon/core.c > @@ -943,6 +943,41 @@ static void damos_set_filters_default_reject(struct damos *s) > damos_filters_default_reject(&s->ops_filters); > } > > +static int damos_commit_dests(struct damos *dst, struct damos *src) > +{ > + struct damos_migrate_dests *dst_dests, *src_dests; > + > + dst_dests = &dst->migrate_dests; > + src_dests = &src->migrate_dests; > + > + if (dst_dests->nr_dests != src_dests->nr_dests) { > + kfree(dst_dests->node_id_arr); > + kfree(dst_dests->weight_arr); > + > + dst_dests->node_id_arr = kmalloc_array(src_dests->nr_dests, > + sizeof(*dst_dests->node_id_arr), GFP_KERNEL); > + if (!dst_dests->node_id_arr) { > + dst_dests->weight_arr = NULL; > + return -ENOMEM; > + } > + > + dst_dests->weight_arr = kmalloc_array(src_dests->nr_dests, > + sizeof(*dst_dests->weight_arr), GFP_KERNEL); > + if (!dst_dests->weight_arr) { > + /* ->node_id_arr will be freed by scheme destruction */ > + return -ENOMEM; > + } > + } > + > + dst_dests->nr_dests = src_dests->nr_dests; > + for (int i = 0; i < src_dests->nr_dests; i++) { > + dst_dests->node_id_arr[i] = src_dests->node_id_arr[i]; > + dst_dests->weight_arr[i] = src_dests->weight_arr[i]; > + } > + > + return 0; > +} > + > static int damos_commit_filters(struct damos *dst, struct damos *src) > { > int err; > @@ -983,6 +1018,11 @@ static int damos_commit(struct damos *dst, struct damos *src) > > dst->wmarks = src->wmarks; > > + dst->target_nid = src->target_nid; > + err = damos_commit_dests(dst, src); > + if (err) > + return err; > + As mentioned above, let's split and post this part as another individual patch. > err = damos_commit_filters(dst, src); > return err; > } > -- > 2.43.5 Thanks, SJ