public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] cpuset: Skip possible unwanted CPU-mask updates.
@ 2022-11-02 10:55 Sebastian Andrzej Siewior
       [not found] ` <20221102105530.1795429-1-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-11-02 10:55 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA
  Cc: Waiman Long, Zefan Li, Tejun Heo, Johannes Weiner,
	Thomas Gleixner

Hi,

while playing with cgroups and tasks which alter their CPU-mask I
noticed a behaviour which is unwanted:
- Upon enabling the cpuset controller, all currently set CPU-mask are
  changed. Here one could argue how bad it is assuming that the
  controller gets only enabled once during boot.

- While having a task limited to only one CPU (or more but a subset of
  the cpuset's mask) then adding an additional CPU (or removing an
  unrelated CPU) from that cpuset results in changing the CPU-mask of
  that task and adding additional CPUs.

The test used to verify the behaviour:

# Limit to CPU 0-1
$ taskset -pc 0-1 $$
# Enable the cpuset controller
$  echo "+cpu" >> /sys/fs/cgroup/cgroup.subtree_control ; echo "+cpuset" >> /sys/fs/cgroup/cgroup.subtree_control

# Query the CPU-mask. Expect to see 0-1 since it is a subset of
# all-online-CPUs
$ taskset -pc $$

# Update the mask to CPUs 1-2
$ taskset -pc 1-2 $$

# Change the CPU-mask of the cgroup to CPUs 1-3.
$ echo 1-3 > /sys/fs/cgroup/user.slice/cpuset.cpus
# Expect to see 1-2 because it is a subset of 1-3
$ taskset -pc $$

# Change the CPU-mask of the cgroup to CPUs 2-3.
$ echo 2-3 > /sys/fs/cgroup/user.slice/cpuset.cpus
# Expect to see 2-3 because CPU 1 is not part of 2-3
$ taskset -pc $$

# Change the CPU-mask of the cgroup to CPUs 2-4.
$ echo 2-4 > /sys/fs/cgroup/user.slice/cpuset.cpus
# Expect to see 2-4 because task's old CPU-mask matches the old mask of
# the cpuset.
$ taskset -pc $$

Posting this as RFC in case I'm missing something obvious or breaking an
unknown (to me) requirement that this series would break.

Sebastian



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-11-11 17:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-02 10:55 [RFC PATCH 0/2] cpuset: Skip possible unwanted CPU-mask updates Sebastian Andrzej Siewior
     [not found] ` <20221102105530.1795429-1-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2022-11-02 10:55   ` [RFC PATCH 1/2] cpuset: Don't change the cpumask on attach if it is a subset Sebastian Andrzej Siewior
2022-11-02 10:55   ` [RFC PATCH 2/2] cpuset: Don't change the cpumask if the task changed it Sebastian Andrzej Siewior
2022-11-02 13:20   ` [RFC PATCH 0/2] cpuset: Skip possible unwanted CPU-mask updates Waiman Long
     [not found]     ` <d0b43b7d-54d3-00bd-abe0-78212ee9355a-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-11-11 15:34       ` Sebastian Andrzej Siewior
     [not found]         ` <Y25rcHYzix+kAJF9-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2022-11-11 16:37           ` Waiman Long
     [not found]             ` <6948de71-a3e3-b6c2-bc67-1bb39cbdff69-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-11-11 16:49               ` Sebastian Andrzej Siewior
     [not found]                 ` <Y259IcCb937bw3AZ-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2022-11-11 17:34                   ` Waiman Long
     [not found]                     ` <f28a00c4-534c-d74a-a14a-f85a1849566e-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-11-11 17:44                       ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox