On 11/11/25 10:33 PM, Chen Ridong wrote:

On 2025/11/12 10:11, Sun Shaojie wrote:
Hello Shaojie,

Currently, when a non-exclusive cpuset's "cpuset.cpus" overlaps with a
partitioned sibling, the sibling's partition state becomes invalid.
However, this invalidation is often unnecessary.

This can be observed in specific configuration sequences:

Case 1: Partition created first, then non-exclusive cpuset overlaps
  #1> mkdir -p /sys/fs/cgroup/A1
  #2> echo "0-1" > /sys/fs/cgroup/A1/cpuset.cpus
  #3> echo "root" > /sys/fs/cgroup/A1/cpuset.cpus.partition
  #4> mkdir -p /sys/fs/cgroup/B1
  #5> echo "0-3" > /sys/fs/cgroup/B1/cpuset.cpus
  // A1's partition becomes "root invalid" - this is unnecessary

Case 2: Non-exclusive cpuset exists first, then partition created
  #1> mkdir -p /sys/fs/cgroup/B1
  #2> echo "0-1" > /sys/fs/cgroup/B1/cpuset.cpus
  #3> mkdir -p /sys/fs/cgroup/A1
  #4> echo "0-1" > /sys/fs/cgroup/A1/cpuset.cpus
  #5> echo "root" > /sys/fs/cgroup/A1/cpuset.cpus.partition
  // A1's partition becomes "root invalid" - this is unnecessary

In Case 1, the effective CPU mask of B1 can differ from its requested
mask. B1 can use CPUs 2-3 which don't overlap with A1's exclusive
CPUs (0-1), thus not violating A1's exclusivity requirement.

In Case 2, B1 can inherit the effective CPUs from its parent, so there
is no need to invalidate A1's partition state.

This patch relaxes the overlap check to only consider conflicts between
partitioned siblings, not between a partitioned cpuset and a regular
non-exclusive one.

Does this rule have any negative impact on your products?

The CPUs specified by the user (including cpuset.cpus and 
cpuset.cpus.exclusive) can be treated as
the dedicated exclusive CPUs for the partition. For the cases you provided, 
both siblings can be
partitions. For example, in case 1, A1 can also be converted to a partition. If 
this rule is
relaxed, I don’t see any check for exclusive conflicts when A1 becomes a 
partition.

Additionally, I think we should preserve the CPU affinity as the user intends 
as much as possible.

Where does the original patch sent to? I didn't see it.

Anyway it is late for me. I will take a further look tomorrow.

Cheers,
Longman


Reply via email to