Skip to content

Commit 74027a6

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Relocate a code block in validate_change()
This patch moves down the exclusive cpu and memory check in validate_change(). There is no functional change. Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 7476a63 commit 74027a6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

kernel/cgroup/cpuset.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -741,22 +741,6 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
741741

742742
par = parent_cs(cur);
743743

744-
/*
745-
* If either I or some sibling (!= me) is exclusive, we can't
746-
* overlap
747-
*/
748-
ret = -EINVAL;
749-
cpuset_for_each_child(c, css, par) {
750-
if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&
751-
c != cur &&
752-
cpumask_intersects(trial->cpus_allowed, c->cpus_allowed))
753-
goto out;
754-
if ((is_mem_exclusive(trial) || is_mem_exclusive(c)) &&
755-
c != cur &&
756-
nodes_intersects(trial->mems_allowed, c->mems_allowed))
757-
goto out;
758-
}
759-
760744
/*
761745
* Cpusets with tasks - existing or newly being attached - can't
762746
* be changed to have empty cpus_allowed or mems_allowed.
@@ -781,6 +765,22 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
781765
trial->cpus_allowed))
782766
goto out;
783767

768+
/*
769+
* If either I or some sibling (!= me) is exclusive, we can't
770+
* overlap
771+
*/
772+
ret = -EINVAL;
773+
cpuset_for_each_child(c, css, par) {
774+
if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&
775+
c != cur &&
776+
cpumask_intersects(trial->cpus_allowed, c->cpus_allowed))
777+
goto out;
778+
if ((is_mem_exclusive(trial) || is_mem_exclusive(c)) &&
779+
c != cur &&
780+
nodes_intersects(trial->mems_allowed, c->mems_allowed))
781+
goto out;
782+
}
783+
784784
ret = 0;
785785
out:
786786
rcu_read_unlock();

0 commit comments

Comments
 (0)