Hello.
On Wed, Jul 27, 2022 at 08:58:14PM -0400, Waiman Long <longman@xxxxxxxxxx> wrote:
It was found that any change to the current cpuset hierarchy may resetI'm surprised this went so long unnoticed / unreported.
the cpus_allowed list of the tasks in the affected cpusets to the
default cpuset value even if those tasks have cpus affinity explicitly
set by the users before.
Could it be users relied on that implicit affinity reset?
The reset is done on all cgroups in a particular subtree. In the case of cgroup root, it is all the processes in the system.That is especially easy to trigger under a cgroup v2 environment whereThis should apply only to tasks that were extracted out of the root
writing "+cpuset" to the root cgroup's cgroup.subtree_control file
will reset the cpus affinity of all the processes in the system.
cgroup, no? (OK, those are all processes practically.)
I also thought about that. Another possible alternative is to use the intersection of cpuset's cpu list and task's own cpu list as long as it is not empty. Reducing the number of cpus assigned to a task may produce some unexpected behavior too.
(Even without your second patch, the scope should be limited because of
src_cset==dst_cset check in cgroup_migrate_prepare_dst().)
That is especially problematic in a nohz_full environment where theOne could also argue that for such processes, cgroup hierarchy should be
tasks running in the nohz_full CPUs usually have their cpus affinity
explicitly set and will behave incorrectly if cpus affinity changes.
first configured and only then they start and set own affinity.
Fix this problem by adding a flag in the task structure to indicate thatI'm uneasy with the occasional revert of this flag, i.e. the task who
a task has their cpus affinity explicitly set before and make cpuset
code not to change their cpus_allowed list unless the user chosen cpu
list is no longer a subset of the cpus_allowed list of the cpuset itself.
set their affinity would sometimes have it overwritten and sometimes
not (which might have been relied on, especially with writes into
cpuset.cpus).
(But I have no better answer than the counter-argument above since
there's no easier way to detect the implicit migrations.)
Also, is there similar effect with memory binding?
Thanks,
Michal