]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpuset: remove redundant special case for null input in node mask update
authorChen Ridong <chenridong@huawei.com>
Mon, 22 Sep 2025 13:02:31 +0000 (13:02 +0000)
committerTejun Heo <tj@kernel.org>
Mon, 22 Sep 2025 22:57:46 +0000 (12:57 -1000)
The nodelist_parse function already handles empty nodemask input
appropriately, making it unnecessary to handle this case separately
during the node mask update process.

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 535174ed712682f52531bd5c11ccff947c735c95..20dface3c3e0eccdc1491d77b3fc4ab23e5de0e5 100644 (file)
@@ -2847,22 +2847,16 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
 
        /*
         * An empty mems_allowed is ok iff there are no tasks in the cpuset.
-        * Since nodelist_parse() fails on an empty mask, we special case
-        * that parsing.  The validate_change() call ensures that cpusets
-        * with tasks have memory.
+        * The validate_change() call ensures that cpusets with tasks have memory.
         */
-       if (!*buf) {
-               nodes_clear(trialcs->mems_allowed);
-       } else {
-               retval = nodelist_parse(buf, trialcs->mems_allowed);
-               if (retval < 0)
-                       goto done;
+       retval = nodelist_parse(buf, trialcs->mems_allowed);
+       if (retval < 0)
+               goto done;
 
-               if (!nodes_subset(trialcs->mems_allowed,
-                                 top_cpuset.mems_allowed)) {
-                       retval = -EINVAL;
-                       goto done;
-               }
+       if (!nodes_subset(trialcs->mems_allowed,
+                         top_cpuset.mems_allowed)) {
+               retval = -EINVAL;
+               goto done;
        }
 
        if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed)) {