Re: [PATCH v1] cpuset: Avoid unnecessary partition invalidation

From: Waiman Long

Date: Wed Nov 12 2025 - 23:12:22 EST


On 11/12/25 10:33 PM, Sun Shaojie wrote:
The reviewer mentioned they couldn't see my original patch, so I'm
re-quoting the key changes below for clarity:

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 52468d2c178a..e0d27c9a101a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -586,14 +586,14 @@ static inline bool cpusets_are_exclusive(struct cpuset *cs1, struct cpuset *cs2)
* Returns: true if CPU exclusivity conflict exists, false otherwise
*
* Conflict detection rules:
- * 1. If either cpuset is CPU exclusive, they must be mutually exclusive
+ * 1. If both cpusets are exclusive, they must be mutually exclusive
* 2. exclusive_cpus masks cannot intersect between cpusets
* 3. The allowed CPUs of one cpuset cannot be a subset of another's exclusive CPUs
*/
static inline bool cpus_excl_conflict(struct cpuset *cs1, struct cpuset *cs2)
{
- /* If either cpuset is exclusive, check if they are mutually exclusive */
- if (is_cpu_exclusive(cs1) || is_cpu_exclusive(cs2))
+ /* If both cpusets are exclusive, check if they are mutually exclusive */
+ if (is_cpu_exclusive(cs1) && is_cpu_exclusive(cs2))
return !cpusets_are_exclusive(cs1, cs2);

/* Exclusive_cpus cannot intersect */
Here are the main changes, where the conflict check for step #6 in Table 2
is performed. And these changes have no effect on cgroup v1.

cpus_excl_conflict() is called by validate_change() which is used for both v1 and v2.

Cheers,
Longman