[RFC PATCH -v4 22/22] cpuset: remove unnecessary validation in partition_cpus_change
From: Ridong Chen
Date: Sun Nov 01 2026 - 06:45:56 EST
From: Chen Ridong <chenridong@xxxxxxxxxx>
When user-configured CPUs (including cpuset.cpus and cpuset.cpus.exclusive)
are modified, the partition may either be disabled or updated. Both local
and remote partitions update can fully validate their own validity: if the
validation fails, the partition will be disabled. Therefore, the
validation in partition_cpus_change is redundant and can be removed.
With that, trialcs->prs_err is never set, so remove its error branches
in partition_cpus_change() and its initialization in update_cpumask()
and update_exclusive_cpumask().
Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 40 +++++-----------------------------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 4fd8b0025a5a..e710e7236922 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2459,43 +2459,15 @@ static int parse_cpuset_cpulist(const char *buf, struct cpumask *out_mask)
static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs,
struct tmpmasks *tmp)
{
- enum prs_errcode prs_err;
- struct cpuset *parent = is_remote_partition(cs) ? NULL : parent_cs(cs);
-
if (cs_is_member(cs))
return;
- /*
- * Check for housekeeping conflict by passing the whole
- * effective_xcpus as well as those CPUs that are to be
- * removed from cs as delmask.
- */
- if (is_partition_valid(cs))
- cpumask_andnot(tmp->delmask, cs->effective_xcpus,
- trialcs->effective_xcpus);
+ if (is_remote_partition(cs))
+ remote_cpus_update(cs, trialcs->exclusive_cpus,
+ trialcs->effective_xcpus, tmp);
else
- cpumask_clear(tmp->delmask);
-
- prs_err = validate_partition(cs, parent, trialcs->partition_root_state,
- trialcs->effective_xcpus, tmp->delmask);
- if (prs_err)
- trialcs->prs_err = prs_err;
-
- if (is_remote_partition(cs)) {
- if (trialcs->prs_err)
- remote_partition_disable(cs, -cs->partition_root_state,
- trialcs->prs_err, tmp);
- else
- remote_cpus_update(cs, trialcs->exclusive_cpus,
- trialcs->effective_xcpus, tmp);
- } else {
- if (trialcs->prs_err)
- local_partition_disable(cs, -cs->partition_root_state,
- trialcs->prs_err, tmp);
- else
- __local_partition_update(cs, trialcs->exclusive_cpus,
- trialcs->effective_xcpus, tmp, false);
- }
+ __local_partition_update(cs, trialcs->exclusive_cpus,
+ trialcs->effective_xcpus, tmp, false);
}
/**
@@ -2521,7 +2493,6 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
return 0;
compute_trialcs_excpus(trialcs, cs);
- trialcs->prs_err = PERR_NONE;
retval = validate_change(cs, trialcs);
if (retval < 0)
@@ -2597,7 +2568,6 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
if (alloc_tmpmasks(&tmp))
return -ENOMEM;
- trialcs->prs_err = PERR_NONE;
partition_cpus_change(cs, trialcs, &tmp);
spin_lock_irq(&callback_lock);
--
2.34.1