]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cgroup/cpuset: remove fetch_xcpus
authorChen Ridong <chenridong@huawei.com>
Tue, 20 Aug 2024 03:01:25 +0000 (03:01 +0000)
committerTejun Heo <tj@kernel.org>
Tue, 20 Aug 2024 18:51:34 +0000 (08:51 -1000)
Both fetch_xcpus and user_xcpus functions are used to retrieve the value
of exclusive_cpus. If exclusive_cpus is not set, cpus_allowed is the
implicit value used as exclusive in a local partition. I can not imagine
a scenario where effective_xcpus is not empty when exclusive_cpus is
empty. Therefore, I suggest removing the fetch_xcpus function.

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 0ae68e0e5733e513989227e17c50862cb5042593..92e79ddc8188188071f73eaef5290afc888c9817 100644 (file)
@@ -771,13 +771,6 @@ static inline bool xcpus_empty(struct cpuset *cs)
               cpumask_empty(cs->exclusive_cpus);
 }
 
-static inline struct cpumask *fetch_xcpus(struct cpuset *cs)
-{
-       return !cpumask_empty(cs->exclusive_cpus) ? cs->exclusive_cpus :
-              cpumask_empty(cs->effective_xcpus) ? cs->cpus_allowed
-                                                 : cs->effective_xcpus;
-}
-
 /*
  * cpusets_are_exclusive() - check if two cpusets are exclusive
  *
@@ -785,8 +778,8 @@ static inline struct cpumask *fetch_xcpus(struct cpuset *cs)
  */
 static inline bool cpusets_are_exclusive(struct cpuset *cs1, struct cpuset *cs2)
 {
-       struct cpumask *xcpus1 = fetch_xcpus(cs1);
-       struct cpumask *xcpus2 = fetch_xcpus(cs2);
+       struct cpumask *xcpus1 = user_xcpus(cs1);
+       struct cpumask *xcpus2 = user_xcpus(cs2);
 
        if (cpumask_intersects(xcpus1, xcpus2))
                return false;
@@ -2585,7 +2578,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
                invalidate = true;
                rcu_read_lock();
                cpuset_for_each_child(cp, css, parent) {
-                       struct cpumask *xcpus = fetch_xcpus(trialcs);
+                       struct cpumask *xcpus = user_xcpus(trialcs);
 
                        if (is_partition_valid(cp) &&
                            cpumask_intersects(xcpus, cp->effective_xcpus)) {