Re: [PATCH v2 2/3] cgroup/cpuset: Skip security check for hotplug induced v1 task migration
From: Waiman Long
Date: Mon Mar 30 2026 - 23:16:26 EST
On 3/30/26 2:21 PM, Tejun Heo wrote:
Hello,
On Mon, Mar 30, 2026 at 12:15:01PM -0400, Waiman Long wrote:
...
During migration, a taskset is used to group tasks in a thread group ifIf there are many tasks in the cpuset that has no CPUs, they will be migratedThe setsched_check flag is used in the cgroup_taskset_for_each() loop below.
one by one. I'm afraid that only the first task will succeed, and the rest will
fail because the flag is cleared after processing the first one.
That loop is going to iterate all the tasks to be migrated and so the flag
will apply to all of them. So it is not just the first one.
cgroup_migrate() called with %true @threadgroup. That doens't really apply
here. cgroup_transfer_tasks() doesn't set @threadgroup and even if it were
to set set, there can just be multiple procesess. Besides, it's rather odd
for it be a one-shot param that gets cleared deep in the stack. Wouldn't it
make more sense to make whoever sets it to be responsible for clearing it?
Apparently, I have misunderstood how cgroup_transfer_tasks() works. Right, it calls cgroup_migrate_execute() on a process-by-process basis. So I shouldn't clear the flag in the first call. As for clearing the flag, I think we can do it in the CPU hot-add situation or when the cpuset.cpus is modified.
Thanks,
Longman