[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251225123058.231765-17-chenridong@huaweicloud.com>
Date: Thu, 25 Dec 2025 12:30:53 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: longman@...hat.com,
tj@...nel.org,
hannes@...xchg.org,
mkoutny@...e.com
Cc: cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org,
lujialin4@...wei.com,
chenridong@...weicloud.com
Subject: [PATCH RESEND -next 16/21] cpuset: use partition_disable for compute_partition_effective_cpumask
From: Chen Ridong <chenridong@...wei.com>
Replace the partition invalidation logic in the
compute_partition_effective_cpumask() with a call to partition_disable().
This centralizes partition state management and ensures consistent
handling of partition disable operations throughout the cpuset subsystem.
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
kernel/cgroup/cpuset.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 99413472a0fb..96a82a3e9add 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -174,15 +174,6 @@ static inline bool cs_is_member(const struct cpuset *cs)
return cs->partition_root_state == PRS_MEMBER;
}
-/*
- * Callers should hold callback_lock to modify partition_root_state.
- */
-static inline void make_partition_invalid(struct cpuset *cs)
-{
- if (cs->partition_root_state > 0)
- cs->partition_root_state = -cs->partition_root_state;
-}
-
/*
* Send notification event of whenever partition_root_state changes.
*/
@@ -1960,6 +1951,7 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
struct cgroup_subsys_state *css;
struct cpuset *child;
bool populated = partition_is_populated(cs, NULL);
+ enum prs_errcode prs_err;
/*
* Check child partition roots to see if they should be
@@ -1982,24 +1974,17 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
* partition root.
*/
WARN_ON_ONCE(is_remote_partition(child));
- child->prs_err = 0;
+ prs_err = 0;
if (!cpumask_subset(child->effective_xcpus,
cs->effective_xcpus))
- child->prs_err = PERR_INVCPUS;
+ prs_err = PERR_INVCPUS;
else if (populated &&
cpumask_subset(new_ecpus, child->effective_xcpus))
- child->prs_err = PERR_NOCPUS;
-
- if (child->prs_err) {
- int old_prs = child->partition_root_state;
+ prs_err = PERR_NOCPUS;
- /*
- * Invalidate child partition
- */
- spin_lock_irq(&callback_lock);
- make_partition_invalid(child);
- spin_unlock_irq(&callback_lock);
- notify_partition_change(child, old_prs);
+ if (prs_err) {
+ partition_disable(child, cs, -child->partition_root_state,
+ prs_err);
continue;
}
cpumask_andnot(new_ecpus, new_ecpus,
--
2.34.1
Powered by blists - more mailing lists