]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
cgroup/cpuset: Enable memory migration for cpuset v2
authorWaiman Long <longman@redhat.com>
Wed, 11 Aug 2021 19:57:07 +0000 (15:57 -0400)
committerTejun Heo <tj@kernel.org>
Thu, 12 Aug 2021 21:40:20 +0000 (11:40 -1000)
commitee9707e8593dfb9a375cf4793c3fd03d4142b463
tree619664d8ce1476fceb69ad451bd7f0fcd6b9e910
parente7cc9888dc57927f0977d346dab64a5bdfc3da59
cgroup/cpuset: Enable memory migration for cpuset v2

When a user changes cpuset.cpus, each task in a v2 cpuset will be moved
to one of the new cpus if it is not there already. For memory, however,
they won't be migrated to the new nodes when cpuset.mems changes. This is
an inconsistency in behavior.

In cpuset v1, there is a memory_migrate control file to enable such
behavior by setting the CS_MEMORY_MIGRATE flag. Make it the default
for cpuset v2 so that we have a consistent set of behavior for both
cpus and memory.

There is certainly a cost to make memory migration the default, but it
is a one time cost that shouldn't really matter as long as cpuset.mems
isn't changed frequenty.  Update the cgroup-v2.rst file to document the
new behavior and recommend against changing cpuset.mems frequently.

Since there won't be any concurrent access to the newly allocated cpuset
structure in cpuset_css_alloc(), we can use the cheaper non-atomic
__set_bit() instead of the more expensive atomic set_bit().

Signed-off-by: Waiman Long <longman@redhat.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Documentation/admin-guide/cgroup-v2.rst
kernel/cgroup/cpuset.c