]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpuset: use parse_cpulist for setting cpus.exclusive
authorChen Ridong <chenridong@huawei.com>
Wed, 17 Sep 2025 06:04:53 +0000 (06:04 +0000)
committerTejun Heo <tj@kernel.org>
Wed, 17 Sep 2025 18:37:31 +0000 (08:37 -1000)
Previous patches made parse_cpulist handle empty cpu mask input.
Now use this helper for exclusive cpus setting. Also, compute_trialcs_xcpus
can be called with empty cpus and handles it correctly.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset.c

index 440f570c666ce5c6830c8f57310d0d84bd8fff5b..5c818b509cb8ee2d369539252c88ac096bffc1e9 100644 (file)
@@ -2566,27 +2566,20 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
        bool force = false;
        int old_prs = cs->partition_root_state;
 
-       if (!*buf) {
-               cpumask_clear(trialcs->exclusive_cpus);
-               cpumask_clear(trialcs->effective_xcpus);
-       } else {
-               retval = cpulist_parse(buf, trialcs->exclusive_cpus);
-               if (retval < 0)
-                       return retval;
-       }
+       retval = parse_cpuset_cpulist(buf, trialcs->exclusive_cpus);
+       if (retval < 0)
+               return retval;
 
        /* Nothing to do if the CPUs didn't change */
        if (cpumask_equal(cs->exclusive_cpus, trialcs->exclusive_cpus))
                return 0;
 
-       if (*buf) {
-               /*
-                * Reject the change if there is exclusive CPUs conflict with
-                * the siblings.
-                */
-               if (compute_trialcs_excpus(trialcs, cs))
-                       return -EINVAL;
-       }
+       /*
+        * Reject the change if there is exclusive CPUs conflict with
+        * the siblings.
+        */
+       if (compute_trialcs_excpus(trialcs, cs))
+               return -EINVAL;
 
        /*
         * Check all the descendants in update_cpumasks_hier() if