Skip to content

Commit 9414f68

Browse files
Chen Ridonghtejun
authored andcommitted
cgroup/cpuset: remove fetch_xcpus
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 <[email protected]> Reviewed-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent e55f45b commit 9414f68

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

kernel/cgroup/cpuset.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -771,22 +771,15 @@ static inline bool xcpus_empty(struct cpuset *cs)
771771
cpumask_empty(cs->exclusive_cpus);
772772
}
773773

774-
static inline struct cpumask *fetch_xcpus(struct cpuset *cs)
775-
{
776-
return !cpumask_empty(cs->exclusive_cpus) ? cs->exclusive_cpus :
777-
cpumask_empty(cs->effective_xcpus) ? cs->cpus_allowed
778-
: cs->effective_xcpus;
779-
}
780-
781774
/*
782775
* cpusets_are_exclusive() - check if two cpusets are exclusive
783776
*
784777
* Return true if exclusive, false if not
785778
*/
786779
static inline bool cpusets_are_exclusive(struct cpuset *cs1, struct cpuset *cs2)
787780
{
788-
struct cpumask *xcpus1 = fetch_xcpus(cs1);
789-
struct cpumask *xcpus2 = fetch_xcpus(cs2);
781+
struct cpumask *xcpus1 = user_xcpus(cs1);
782+
struct cpumask *xcpus2 = user_xcpus(cs2);
790783

791784
if (cpumask_intersects(xcpus1, xcpus2))
792785
return false;
@@ -2585,7 +2578,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
25852578
invalidate = true;
25862579
rcu_read_lock();
25872580
cpuset_for_each_child(cp, css, parent) {
2588-
struct cpumask *xcpus = fetch_xcpus(trialcs);
2581+
struct cpumask *xcpus = user_xcpus(trialcs);
25892582

25902583
if (is_partition_valid(cp) &&
25912584
cpumask_intersects(xcpus, cp->effective_xcpus)) {

0 commit comments

Comments
 (0)