hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/9840 ------------------ When reparenting a monitor group (RDTMON_GROUP) to a new control group (RDTCTRL_GROUP), mongrp_reparent() updates rdtgrp->closid to the new parent's closid before calling rdt_move_group_tasks(). However, rdt_move_group_tasks() expects the first argument to be the *original* group (to identify tasks by their current closid) and the second argument to be the *destination* group (to update tasks to the new closid). By passing rdtgrp for both arguments after modifying its closid, the function fails to find any tasks to migrate because it searches for the new closid instead of the old one. Fix this by saving a copy of the original rdtgrp state before modifying it, then passing the copy as the source and the updated rdtgrp as the destination to rdt_move_group_tasks(). Fixes: 43132396266d ("fs/resctrl: Re-allocate rmid for the monitor when migrating across control groups") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/rdtgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 428e6538072e0..16c4f9311111d 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3852,6 +3852,7 @@ static void mongrp_reparent(struct rdtgroup *rdtgrp, cpumask_var_t cpus) { struct rdtgroup *prdtgrp = rdtgrp->mon.parent; + struct rdtgroup old_rdtgrp = *rdtgrp; WARN_ON(rdtgrp->type != RDTMON_GROUP); WARN_ON(new_prdtgrp->type != RDTCTRL_GROUP); @@ -3870,7 +3871,7 @@ static void mongrp_reparent(struct rdtgroup *rdtgrp, rdtgrp->closid = new_prdtgrp->closid; /* Propagate updated closid to all tasks in this group. */ - rdt_move_group_tasks(rdtgrp, rdtgrp, cpus); + rdt_move_group_tasks(&old_rdtgrp, rdtgrp, cpus); update_closid_rmid(cpus, NULL); } -- 2.43.0