]> git.ipfire.org Git - thirdparty/linux.git/commit
cgroup/cpuset: record DL BW alloc CPU for attach rollback
authorGuopeng Zhang <zhangguopeng@kylinos.cn>
Fri, 17 Apr 2026 03:37:41 +0000 (11:37 +0800)
committerTejun Heo <tj@kernel.org>
Fri, 17 Apr 2026 18:57:37 +0000 (08:57 -1000)
commit41d701ddc36d5301b44ea79529f3cf03c541c1e1
tree523c05c96efdf4fa91257c96bf42b15b0c6e2c51
parentc802f460dd485c1332b5a35e7adcfb2bc22536a2
cgroup/cpuset: record DL BW alloc CPU for attach rollback

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>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset-internal.h
kernel/cgroup/cpuset.c