[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250928071306.3797436-16-chenridong@huaweicloud.com>
Date: Sun, 28 Sep 2025 07:13:05 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: longman@...hat.com,
tj@...nel.org,
hannes@...xchg.org,
mkoutny@...e.com
Cc: cgups@...r.kernel.org,
linux-kernel@...r.kernel.org,
lujialin4@...wei.com,
chenridong@...wei.com
Subject: [PATCH -next RFC 15/16] cpuset: use partition_disable for update_prstate
From: Chen Ridong <chenridong@...wei.com>
The update_prstate() function currently handles partition state transitions
by directly manipulating partition-related fields. However, when a
partition is enabled or disabled through the proper interfaces, these
fields are already set correctly, making the direct manipulation redundant.
This patch refactors the logic to use partition_disable() when partition
errors are detected, ensuring consistent state management. For successful
state transitions, the partition-related fields are set appropriately.
This change eliminates redundant field manipulation and centralizes
partition state management through the established partition_disable()
interface, improving code maintainability and consistency.
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
kernel/cgroup/cpuset.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 2aaa688c596f..a22cf97e6af5 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2961,17 +2961,8 @@ static int update_prstate(struct cpuset *cs, int new_prs)
* Make partition invalid & disable CS_CPU_EXCLUSIVE if an error
* happens.
*/
- if (err) {
- new_prs = -new_prs;
- update_partition_exclusive_flag(cs, new_prs);
- }
-
- spin_lock_irq(&callback_lock);
- cs->partition_root_state = new_prs;
- WRITE_ONCE(cs->prs_err, err);
- if (!is_partition_valid(cs))
- reset_partition_data(cs);
- spin_unlock_irq(&callback_lock);
+ if (err)
+ partition_disable(cs, parent, -new_prs, err);
/* Force update if switching back to member & update effective_xcpus */
update_cpumasks_hier(cs, &tmpmask, !new_prs);
@@ -2983,7 +2974,6 @@ static int update_prstate(struct cpuset *cs, int new_prs)
/* Update sched domains and load balance flag */
update_partition_sd_lb(cs, old_prs);
- notify_partition_change(cs, old_prs);
if (force_sd_rebuild)
rebuild_sched_domains_locked();
free_tmpmasks(&tmpmask);
--
2.34.1
Powered by blists - more mailing lists