From: Waiman Long <longman@redhat.com>
To: Guopeng Zhang <zhangguopeng@kylinos.cn>,
tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com,
void@manifault.com, arighi@nvidia.com, changwoo@igalia.com,
shuah@kernel.org, chenridong@huaweicloud.com,
Juri Lelli <juri.lelli@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: cgroups@vger.kernel.org, sched-ext@lists.linux.dev,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] cgroup/cpuset: record DL BW alloc CPU for attach rollback
Date: Sun, 19 Apr 2026 22:31:29 -0400 [thread overview]
Message-ID: <e0fea6ec-397c-40a6-9300-a3529a3d1167@redhat.com> (raw)
In-Reply-To: <6aca2465-1ea7-417a-beb8-e385fa3902bf@kylinos.cn>
On 4/19/26 10:21 PM, Guopeng Zhang wrote:
>
> 在 2026/4/18 2:51, Waiman Long 写道:
>> On 4/16/26 11:37 PM, Guopeng Zhang wrote:
>>> cpuset_can_attach() allocates DL bandwidth only when migrating
>>> deadline tasks to a disjoint CPU mask, but cpuset_cancel_attach()
>>> rolls back based only on nr_migrate_dl_tasks. This makes the DL
>>> bandwidth alloc/free paths asymmetric: rollback can call dl_bw_free()
>>> even when no dl_bw_alloc() was done.
>>>
>>> Rollback also needs to undo the reservation against the same CPU/root
>>> domain that was charged. Record the CPU used by dl_bw_alloc() and use
>>> that state in cpuset_cancel_attach(). If no allocation happened,
>>> dl_bw_cpu stays at -1 and rollback skips dl_bw_free(). If allocation
>>> did happen, bandwidth is returned to the same CPU/root domain.
>>>
>>> Successful attach paths are unchanged. This only fixes failed attach
>>> rollback accounting.
>>>
>>> Fixes: 2ef269ef1ac0 ("cgroup/cpuset: Free DL BW in case can_attach() fails")
>>> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
> ...
>> The patch looks correct to me.
>>
>> Reviewed-by: Waiman Long <longman@redhat.com>
> Hi Waiman,
>
> Thank you for the review and for the Reviewed-by.
>> However, I have a DL bandwidth accounting question unrelated to this patch that I would like the scheduler people to clarify. The allocation of additional DL BW is based on the condition
>>
>> if (!cpumask_intersects(oldcs->effective_cpus, cs->effective_cpus)) {
>>
>> IOW, additional DL BW will need to be allocated when the old and new cpuset doesn't overlap. However, they could still be in the same root domain. Does that mean we will be double counting it?
> I think you are right to call this out. Looking at the
> current logic, !cpumask_intersects(oldcs->effective_cpus, cs->effective_cpus)
> does not obviously guarantee that the migration is crossing into a different
> root domain. If the old and new cpusets are disjoint but still belong to the
> same root domain, it does look possible that we reserve bandwidth on the
> destination side without a corresponding subtraction from the source side.
> I will try to reproduce that configuration and follow up with results.
>> Looking from the other side, the root domain may have enough DL BW for the task migration, but the subset of CPUs in the cpuset itself may not have enough total DL BW to host all the DL tasks to be migrated, is that a problem?
> my current understanding is that the DL bandwidth
> accounting is done at root-domain granularity, not at arbitrary cpuset-subset
> granularity.
That is my understanding too.
> That also seems consistent with
> Documentation/scheduler/sched-deadline.rst, which says that deadline tasks
> cannot have a CPU affinity mask smaller than the root domain they are created
> on, and that a restricted CPU set should be achieved by creating a restricted
> root domain with cpuset.
A root domain should be created by creating cpuset root partition for v2
or using the cpuset.cpu_exclusive flag in v1.
What is listed in the documentation is the ideal case, but users may not
strictly follow the rule.
Cheers,
Longman
>
> So if a cpuset is only a subset inside a larger root domain, it does not seem
> to get an independent DL bandwidth limit of its own. If that understanding is
> correct, then the smaller cpuset not having enough bandwidth by itself would
> be a limitation of that model rather than something this code checks
> separately. I'd appreciate confirmation from the scheduler folks on that
> point.
>
> Thanks,
> Guopeng
>> Cheers,
>> Longman
next prev parent reply other threads:[~2026-04-20 2:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 3:37 [PATCH 0/2] cgroup/cpuset: fix DL rollback accounting and add a selftest Guopeng Zhang
2026-04-17 3:37 ` [PATCH 1/2] cgroup/cpuset: record DL BW alloc CPU for attach rollback Guopeng Zhang
2026-04-17 18:51 ` Waiman Long
2026-04-20 2:21 ` Guopeng Zhang
2026-04-20 2:31 ` Waiman Long [this message]
2026-04-20 7:58 ` Juri Lelli
2026-04-21 8:53 ` Guopeng Zhang
2026-04-20 2:23 ` Chen Ridong
2026-04-17 3:37 ` [PATCH 2/2] selftests/sched_ext: add cpuset DL rollback test Guopeng Zhang
2026-04-17 16:23 ` Cheng-Yang Chou
2026-04-20 1:56 ` Guopeng Zhang
2026-04-17 19:03 ` [PATCH 0/2] cgroup/cpuset: fix DL rollback accounting and add a selftest Tejun Heo
2026-04-20 2:35 ` Guopeng Zhang
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=e0fea6ec-397c-40a6-9300-a3529a3d1167@redhat.com \
--to=longman@redhat.com \
--cc=arighi@nvidia.com \
--cc=cgroups@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=chenridong@huaweicloud.com \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=sched-ext@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=vschneid@redhat.com \
--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
all inboxes | Powered by JetHome®