[PATCH 5/7] cgroup: Concentrate DL related validation code in one place

From: Mathieu Poirier
Date: Wed Aug 16 2017 - 17:21:06 EST


Having two different places to validate DL operations makes no sense. As
such move everything in the same function.

Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 18df143b4013..8d2ba5591dfb 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -477,6 +477,15 @@ static int validate_dl_change(struct cpuset *cur, struct cpuset *trial)
struct cpuset *cs;

/*
+ * We can't shrink if we won't have enough room for SCHED_DEADLINE
+ * tasks.
+ */
+ if (is_cpu_exclusive(cur) &&
+ !cpuset_cpumask_can_shrink(cur->cpus_allowed,
+ trial->cpus_allowed))
+ goto out;
+
+ /*
* The cpuset.sched_load_balance flag is flipped off on
* the current cpuset.
*/
@@ -606,16 +615,6 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
goto out;
}

- /*
- * We can't shrink if we won't have enough room for SCHED_DEADLINE
- * tasks.
- */
- ret = -EBUSY;
- if (is_cpu_exclusive(cur) &&
- !cpuset_cpumask_can_shrink(cur->cpus_allowed,
- trial->cpus_allowed))
- goto out;
-
ret = 0;
out:
rcu_read_unlock();
--
2.7.4