[PATCH-next 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2

From: Waiman Long

Date: Sun Sep 27 2026 - 12:36:27 EST


With the move of is_cpu_exclusive() DEADLINE shrink test into
cpuset1_validate_change() in the previous patch, there is no need to
have the CS_CPU_EXCLUSIVE flag set on valid partition root anymore.
Remove update_partition_exclusive_flag() and other CS_CPU_EXCLUSIVE
flag handling code in cpuset.c.

Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 52 ++++--------------------------------------
1 file changed, 4 insertions(+), 48 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 5639c486c967..b07a7e8cef16 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1166,25 +1166,6 @@ enum partition_cmd {
static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
struct tmpmasks *tmp);

-/*
- * Update partition exclusive flag
- *
- * Return: 0 if successful, an error code otherwise
- */
-static int update_partition_exclusive_flag(struct cpuset *cs, int new_prs)
-{
- bool exclusive = (new_prs > PRS_MEMBER);
-
- if (exclusive && !is_cpu_exclusive(cs)) {
- if (cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 1))
- return PERR_NOTEXCL;
- } else if (!exclusive && is_cpu_exclusive(cs)) {
- /* Turning off CS_CPU_EXCLUSIVE will not return error */
- cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 0);
- }
- return 0;
-}
-
/*
* Update partition load balance flag and/or rebuild sched domain
*
@@ -1240,11 +1221,9 @@ static void reset_partition_data(struct cpuset *cs)

lockdep_assert_held(&callback_lock);

- if (cpumask_empty(cs->exclusive_cpus)) {
+ if (cpumask_empty(cs->exclusive_cpus))
cpumask_clear(cs->effective_xcpus);
- if (is_cpu_exclusive(cs))
- clear_bit(CS_CPU_EXCLUSIVE, &cs->flags);
- }
+
if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed))
cpumask_copy(cs->effective_cpus, parent->effective_cpus);
}
@@ -2020,19 +1999,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
if (!adding && !deleting && (new_prs == old_prs))
return 0;

- /*
- * Transitioning between invalid to valid or vice versa may require
- * changing CS_CPU_EXCLUSIVE. In the case of partcmd_update,
- * validate_change() has already been successfully called and
- * CPU lists in cs haven't been updated yet. So defer it to later.
- */
- if ((old_prs != new_prs) && (cmd != partcmd_update)) {
- int err = update_partition_exclusive_flag(cs, new_prs);
-
- if (err)
- return err;
- }
-
/*
* Change the parent's effective_cpus & effective_xcpus (top cpuset
* only).
@@ -2055,9 +2021,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,

spin_unlock_irq(&callback_lock);

- if ((old_prs != new_prs) && (cmd == partcmd_update))
- update_partition_exclusive_flag(cs, new_prs);
-
if (adding || deleting) {
cpuset_update_tasks_cpumask(parent, tmp->addmask);
update_sibling_cpumasks(parent, cs, tmp);
@@ -2934,10 +2897,6 @@ static int update_prstate(struct cpuset *cs, int new_prs)
if (alloc_tmpmasks(&tmpmask))
return -ENOMEM;

- err = update_partition_exclusive_flag(cs, new_prs);
- if (err)
- goto out;
-
if (!old_prs) {
/*
* cpus_allowed and exclusive_cpus cannot be both empty.
@@ -3001,13 +2960,10 @@ static int update_prstate(struct cpuset *cs, int new_prs)
}
out:
/*
- * Make partition invalid & disable CS_CPU_EXCLUSIVE if an error
- * happens.
+ * Make partition invalid if an error happens.
*/
- if (err) {
+ if (err)
new_prs = -new_prs;
- update_partition_exclusive_flag(cs, new_prs);
- }

spin_lock_irq(&callback_lock);
cs->partition_root_state = new_prs;
--
2.55.0