* [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset
@ 2026-09-01 13:13 Karl Mehltretter
2026-09-02 22:14 ` Sasha Levin
2026-09-03 13:21 ` Guopeng Zhang
0 siblings, 2 replies; 3+ messages in thread
From: Karl Mehltretter @ 2026-09-01 13:13 UTC (permalink / raw)
To: stable
Cc: Waiman Long, Ridong Chen, Tejun Heo, Johannes Weiner,
Michal Koutný, Guopeng Zhang, Chen Ridong,
Greg Kroah-Hartman, Sasha Levin, cgroups, linux-kernel,
Karl Mehltretter
Mainline commit 4a39eda5fdd8 ("cgroup/cpuset: Reset DL migration state
on can_attach() failure") puts the common error cleanup in
cpuset_can_attach(). The 6.1.y backport instead placed that hunk at
cpuset_can_fork()'s similarly named out_unlock label, while removing
cpuset_can_attach()'s two existing targeted resets.
If cpuset_can_attach() fails after accounting a SCHED_DEADLINE task,
cgroup_migrate_execute() does not call cpuset_cancel_attach() for the
failing subsystem. The temporary migration fields remain set, and a
later successful migration can consume the stale state and corrupt
deadline-task and pending-bandwidth accounting.
Move the reset to cpuset_can_attach()'s common error exit. It is not
needed in cpuset_can_fork(), which never accumulates migration DL state.
Fixes: f8a8358832f3 ("cgroup/cpuset: Reset DL migration state on can_attach() failure")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
Applies to Linux 6.1.186 and 6.1.187-rc1.
A controlled QEMU A/B on 6.1.186 forced an attach error after accounting a
real SCHED_DEADLINE task. The affected kernel returned with
nr_migrate_dl_tasks=1 and sum_migrate_dl_bw=104857; both fields were zero
with this patch.
The equivalent 6.6.y correction is submitted separately.
kernel/cgroup/cpuset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 681b52f6aae5b..7123bb020a242 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2600,6 +2600,8 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
*/
cs->attach_in_progress++;
out_unlock:
+ if (ret)
+ reset_migrate_dl_data(cs);
mutex_unlock(&cpuset_mutex);
return ret;
}
@@ -3405,8 +3407,6 @@ static int cpuset_can_fork(struct task_struct *task, struct css_set *cset)
cs->attach_in_progress++;
out_unlock:
- if (ret)
- reset_migrate_dl_data(cs);
mutex_unlock(&cpuset_mutex);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset
2026-09-01 13:13 [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset Karl Mehltretter
@ 2026-09-02 22:14 ` Sasha Levin
2026-09-03 13:21 ` Guopeng Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-09-02 22:14 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Waiman Long, Ridong Chen, Tejun Heo, Johannes Weiner,
Michal Koutný, Guopeng Zhang, Chen Ridong,
Greg Kroah-Hartman, cgroups, linux-kernel, Karl Mehltretter
> Mainline commit 4a39eda5fdd8 ("cgroup/cpuset: Reset DL migration state
> on can_attach() failure") puts the common error cleanup in
> cpuset_can_attach(). The 6.1.y backport instead placed that hunk at
> cpuset_can_fork()'s similarly named out_unlock label, while removing
> cpuset_can_attach()'s two existing targeted resets.
An ack from the maintainers would be great!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset
2026-09-01 13:13 [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset Karl Mehltretter
2026-09-02 22:14 ` Sasha Levin
@ 2026-09-03 13:21 ` Guopeng Zhang
1 sibling, 0 replies; 3+ messages in thread
From: Guopeng Zhang @ 2026-09-03 13:21 UTC (permalink / raw)
To: Karl Mehltretter, stable
Cc: Waiman Long, Ridong Chen, Tejun Heo, Johannes Weiner,
Michal Koutný, Guopeng Zhang, Chen Ridong,
Greg Kroah-Hartman, Sasha Levin, cgroups, linux-kernel
在 2026/9/1 21:13, Karl Mehltretter 写道:
> Mainline commit 4a39eda5fdd8 ("cgroup/cpuset: Reset DL migration state
> on can_attach() failure") puts the common error cleanup in
> cpuset_can_attach(). The 6.1.y backport instead placed that hunk at
> cpuset_can_fork()'s similarly named out_unlock label, while removing
> cpuset_can_attach()'s two existing targeted resets.
>
> If cpuset_can_attach() fails after accounting a SCHED_DEADLINE task,
> cgroup_migrate_execute() does not call cpuset_cancel_attach() for the
> failing subsystem. The temporary migration fields remain set, and a
> later successful migration can consume the stale state and corrupt
> deadline-task and pending-bandwidth accounting.
>
> Move the reset to cpuset_can_attach()'s common error exit. It is not
> needed in cpuset_can_fork(), which never accumulates migration DL state.
>
> Fixes: f8a8358832f3 ("cgroup/cpuset: Reset DL migration state on can_attach() failure")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> Applies to Linux 6.1.186 and 6.1.187-rc1.
>
> A controlled QEMU A/B on 6.1.186 forced an attach error after accounting a
> real SCHED_DEADLINE task. The affected kernel returned with
> nr_migrate_dl_tasks=1 and sum_migrate_dl_bw=104857; both fields were zero
> with this patch.
>
> The equivalent 6.6.y correction is submitted separately.
>
> kernel/cgroup/cpuset.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 681b52f6aae5b..7123bb020a242 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2600,6 +2600,8 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
> */
> cs->attach_in_progress++;
> out_unlock:
> + if (ret)
> + reset_migrate_dl_data(cs);
> mutex_unlock(&cpuset_mutex);
> return ret;
> }
> @@ -3405,8 +3407,6 @@ static int cpuset_can_fork(struct task_struct *task, struct css_set *cset)
> cs->attach_in_progress++;
>
> out_unlock:
> - if (ret)
> - reset_migrate_dl_data(cs);
> mutex_unlock(&cpuset_mutex);
> return ret;
> }
Acked-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-03 13:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 13:13 [PATCH 6.1.y] cgroup/cpuset: Fix misplaced DL migration reset Karl Mehltretter
2026-09-02 22:14 ` Sasha Levin
2026-09-03 13:21 ` Guopeng Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox