Re: [PATCH -next RFC 08/11] cpuset: refactor acpus_validate_change

From: Waiman Long
Date: Fri Aug 29 2025 - 16:13:04 EST


On 8/28/25 8:56 AM, Chen Ridong wrote:
From: Chen Ridong <chenridong@xxxxxxxxxx>

Refactor acpus_validate_change to handle the special case where
cpuset.cpus can be set even when violating partition sibling CPU
exclusivity rules. This differs from the general validation logic in
validate_change. Add a wrapper function to properly handle this
exceptional case.

Since partition invalidation status can be determined by trialcs->prs_err,
the local variable 'bool invalidate' can be removed.

Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 83 +++++++++++++++++++++++-------------------
1 file changed, 45 insertions(+), 38 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 71190f142700..75ad18ab40ae 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2410,43 +2410,11 @@ static bool invalidate_cs_partition(struct cpuset *cs)
return false;
}
-/**
- * update_cpumask - update the cpus_allowed mask of a cpuset and all tasks in it
- * @cs: the cpuset to consider
- * @trialcs: trial cpuset
- * @buf: buffer of cpu numbers written to this cpuset
- */
-static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
- const char *buf)
+static int acpus_validate_change(struct cpuset *cs, struct cpuset *trialcs,
+ struct tmpmasks *tmp)

What does "acpu" stand for? I suppose it means cpus_allowed. I will suggest to use a more descriptive name even if it is longer. I did use xcpus for exclusive_cpus, but 'x' is a seldomly used English alphabet that can associate with exclusive_cpus rather easily, but 'a' is not.

Cheers,
Longman