Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v3 0/1] cpuset: relax the overlap check for cgroup-v2
@ 2025-11-17  1:57 Sun Shaojie
  2025-11-17  1:57 ` [PATCH v4 1/1] " Sun Shaojie
  2025-11-17  3:23 ` [PATCH v3 0/1] " Chen Ridong
  0 siblings, 2 replies; 52+ messages in thread
From: Sun Shaojie @ 2025-11-17  1:57 UTC (permalink / raw)
  To: llong
  Cc: chenridong, mkoutny, cgroups, hannes, linux-kernel,
	linux-kselftest, shuah, tj, Sun Shaojie

In cgroup v2, a mutual overlap check is required when at least one of two
cpusets is exclusive. However, this check should be relaxed and limited to
cases where both cpusets are exclusive.

This patch ensures that for sibling cpusets A1 (exclusive) and B1
(non-exclusive), change B1 cannot affect A1's exclusivity.

for example. Assume a machine has 4 CPUs (0-3).

   root cgroup
      /    \
    A1      B1

Case 1:
 Table 1.1: Before applying the patch
 Step                                       | A1's prstate | B1'sprstate |
 #1> echo "0-1" > A1/cpuset.cpus            | member       | member      |
 #2> echo "root" > A1/cpuset.cpus.partition | root         | member      |
 #3> echo "0" > B1/cpuset.cpus              | root invalid | member      |

After step #3, A1 changes from "root" to "root invalid" because its CPUs
(0-1) overlap with those requested by B1 (0-3). However, B1 can actually
use CPUs 2-3(from B1's parent), so it would be more reasonable for A1 to
remain as "root."

 Table 1.2: After applying the patch
 Step                                       | A1's prstate | B1'sprstate |
 #1> echo "0-1" > A1/cpuset.cpus            | member       | member      |
 #2> echo "root" > A1/cpuset.cpus.partition | root         | member      |
 #3> echo "0" > B1/cpuset.cpus              | root         | member      |

Case 2: (This situation remains unchanged from before)
 Table 2.1: Before applying the patch
 Step                                       | A1's prstate | B1'sprstate |
 #1> echo "0-1" > A1/cpuset.cpus            | member       | member      |
 #3> echo "1-2" > B1/cpuset.cpus            | member       | member      |
 #2> echo "root" > A1/cpuset.cpus.partition | root invalid | member      |

 Table 2.2: After applying the patch
 Step                                       | A1's prstate | B1'sprstate |
 #1> echo "0-1" > A1/cpuset.cpus            | member       | member      |
 #3> echo "1-2" > B1/cpuset.cpus            | member       | member      |
 #2> echo "root" > A1/cpuset.cpus.partition | root invalid | member      |

All other cases remain unaffected. For example, cgroup-v1, both A1 and
B1 are exclusive or non-exlusive.

---
v3 -> v4:
  - Adjust the test_cpuset_prt.sh test file to align with the current
    behavior.

v2 -> v3:
  - Ensure compliance with constraints such as cpuset.cpus.exclusive.
  - Link: https://lore.kernel.org/cgroups/20251113131434.606961-1-sunshaojie@kylinos.cn/

v1 -> v2:
  - Keeps the current cgroup v1 behavior unchanged
  - Link: https://lore.kernel.org/cgroups/c8e234f4-2c27-4753-8f39-8ae83197efd3@redhat.com

---
 kernel/cgroup/cpuset-internal.h               |  3 ++
 kernel/cgroup/cpuset-v1.c                     | 20 +++++++++
 kernel/cgroup/cpuset.c                        | 43 ++++++++++++++-----
 .../selftests/cgroup/test_cpuset_prs.sh       |  5 ++-
 4 files changed, 58 insertions(+), 13 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2025-12-25  7:30 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17  1:57 [PATCH v3 0/1] cpuset: relax the overlap check for cgroup-v2 Sun Shaojie
2025-11-17  1:57 ` [PATCH v4 1/1] " Sun Shaojie
2025-11-17  7:45   ` Chen Ridong
2025-11-17 10:00     ` Sun Shaojie
2025-11-17 11:37       ` Chen Ridong
2025-11-19 10:57         ` [PATCH v5] cpuset: Avoid invalidating sibling partitions on cpuset.cpus conflict Sun Shaojie
2025-11-19 13:20           ` Michal Koutný
2025-11-20  0:57             ` Chen Ridong
2025-11-20 13:07               ` Sun Shaojie
2025-11-20 13:25                 ` Chen Ridong
2025-11-21 10:33                   ` Sun Shaojie
2025-11-22  1:19                     ` Chen Ridong
2025-11-24 10:21                       ` Sun Shaojie
2025-11-20 13:05             ` Sun Shaojie
2025-11-26 14:13               ` Michal Koutný
2025-11-27  1:57                 ` Chen Ridong
2025-12-01  9:42                 ` Sun Shaojie
2025-11-20  0:51           ` Chen Ridong
2025-11-20 13:07             ` Sun Shaojie
2025-11-20 13:45               ` Chen Ridong
2025-11-21 10:32                 ` Sun Shaojie
2025-11-22  1:33                   ` Chen Ridong
2025-11-24 10:20                     ` Sun Shaojie
2025-11-24 11:33                       ` Chen Ridong
2025-11-26 12:29                         ` Sun Shaojie
2025-11-24 22:30           ` Waiman Long
2025-11-26 12:31             ` Sun Shaojie
2025-11-26 14:13             ` Michal Koutný
2025-11-26 19:43               ` Waiman Long
2025-11-27  1:55                 ` Chen Ridong
2025-12-01  9:44                   ` Sun Shaojie
2025-12-08 14:31                     ` Michal Koutný
2025-12-10 10:11                       ` Sun Shaojie
2025-12-11 10:59                         ` Michal Koutný
2025-12-12 10:10                           ` Sun Shaojie
2025-12-13  0:52                     ` Chen Ridong
2025-12-17  9:09                       ` Sun Shaojie
2025-12-08 14:32                 ` Michal Koutný
2025-12-13  4:58                   ` Waiman Long
2025-12-01  9:38             ` [PATCH v6] " Sun Shaojie
2025-12-17  9:45               ` [PING][PATCH " Sun Shaojie
2025-12-23  6:06                 ` Waiman Long
2025-12-22 15:26               ` [PATCH " Michal Koutný
2025-12-23  6:03                 ` Waiman Long
2025-12-25  7:30               ` Waiman Long
2025-11-19 11:03         ` [PATCH v4 1/1] cpuset: relax the overlap check for cgroup-v2 Sun Shaojie
2025-11-18 17:52   ` Michal Koutný
2025-11-19 11:04     ` Sun Shaojie
2025-11-18 19:53   ` Waiman Long
2025-11-19 11:05     ` Sun Shaojie
2025-11-17  3:23 ` [PATCH v3 0/1] " Chen Ridong
2025-11-17  5:58   ` Sun Shaojie

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