From: Waiman Long <longman@redhat.com>
To: "Guopeng Zhang" <zhangguopeng@kylinos.cn>,
"Tejun Heo" <tj@kernel.org>, "Michal Koutný" <mkoutny@suse.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Chen Ridong" <chenridong@huaweicloud.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Gabriele Monaco <gmonaco@redhat.com>,
Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org
Subject: Re: [PATCH v3 1/2] cgroup/cpuset: reset DL migration state on can_attach() failure
Date: Mon, 11 May 2026 01:04:13 -0400 [thread overview]
Message-ID: <9d6953bf-7726-45eb-91d0-63e24691bdc6@redhat.com> (raw)
In-Reply-To: <20260509102031.97608-2-zhangguopeng@kylinos.cn>
On 5/9/26 6:20 AM, Guopeng Zhang wrote:
> cpuset_can_attach() accumulates temporary SCHED_DEADLINE migration
> state in the destination cpuset while walking the taskset.
>
> If a later task_can_attach() or security_task_setscheduler() check
> fails, cgroup_migrate_execute() treats cpuset as the failing subsystem
> and does not call cpuset_cancel_attach() for it. The partially
> accumulated state is then left behind and can be consumed by a later
> attach, corrupting cpuset DL task accounting and pending DL bandwidth
> accounting.
>
> Reset the pending DL migration state from the common error exit when
> ret is non-zero. Successful can_attach() keeps the state for
> cpuset_attach() or cpuset_cancel_attach().
>
> Fixes: 2ef269ef1ac0 ("cgroup/cpuset: Free DL BW in case can_attach() fails")
> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
> ---
> kernel/cgroup/cpuset.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index e3a081a07c6d..b9c839538900 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -3050,16 +3050,13 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
> int cpu = cpumask_any_and(cpu_active_mask, cs->effective_cpus);
>
> if (unlikely(cpu >= nr_cpu_ids)) {
> - reset_migrate_dl_data(cs);
> ret = -EINVAL;
> goto out_unlock;
> }
>
> ret = dl_bw_alloc(cpu, cs->sum_migrate_dl_bw);
> - if (ret) {
> - reset_migrate_dl_data(cs);
> + if (ret)
> goto out_unlock;
> - }
>
> cs->dl_bw_cpu = cpu;
> }
> @@ -3070,7 +3067,10 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
> * changes which zero cpus/mems_allowed.
> */
> cs->attach_in_progress++;
> +
> out_unlock:
> + if (ret)
> + reset_migrate_dl_data(cs);
> mutex_unlock(&cpuset_mutex);
> return ret;
> }
Reviewed-by: Waiman Long <longman@redhat.com>
next prev parent reply other threads:[~2026-05-11 5:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 10:20 [PATCH v3 0/2] cgroup/cpuset: fix DL attach accounting Guopeng Zhang
2026-05-09 10:20 ` [PATCH v3 1/2] cgroup/cpuset: reset DL migration state on can_attach() failure Guopeng Zhang
2026-05-11 2:48 ` Chen Ridong
2026-05-11 5:04 ` Waiman Long [this message]
2026-05-11 8:18 ` Tejun Heo
2026-05-11 9:17 ` Juri Lelli
2026-05-09 10:20 ` [PATCH v3 2/2] cgroup/cpuset: reserve DL bandwidth only for root-domain moves Guopeng Zhang
2026-05-11 9:17 ` Juri Lelli
2026-05-11 20:00 ` Waiman Long
2026-05-11 20:29 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d6953bf-7726-45eb-91d0-63e24691bdc6@redhat.com \
--to=longman@redhat.com \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huaweicloud.com \
--cc=dietmar.eggemann@arm.com \
--cc=gmonaco@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=will@kernel.org \
--cc=zhangguopeng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox