sched/deadline: Ensure that updates to exclusive cpusets don't break AC
[firefly-linux-kernel-4.4.55.git] / kernel / sched / core.c
index 9993feeb8b1088c930d0642eaf55a797d915b368..0456a55fc27fe72fb7ebbc5d3094514a3989492d 100644 (file)
@@ -4650,6 +4650,25 @@ void init_idle(struct task_struct *idle, int cpu)
 #endif
 }
 
+int cpuset_cpumask_can_shrink(const struct cpumask *cur,
+                             const struct cpumask *trial)
+{
+       int ret = 1, trial_cpus;
+       struct dl_bw *cur_dl_b;
+       unsigned long flags;
+
+       cur_dl_b = dl_bw_of(cpumask_any(cur));
+       trial_cpus = cpumask_weight(trial);
+
+       raw_spin_lock_irqsave(&cur_dl_b->lock, flags);
+       if (cur_dl_b->bw != -1 &&
+           cur_dl_b->bw * trial_cpus < cur_dl_b->total_bw)
+               ret = 0;
+       raw_spin_unlock_irqrestore(&cur_dl_b->lock, flags);
+
+       return ret;
+}
+
 int task_can_attach(struct task_struct *p,
                    const struct cpumask *cs_cpus_allowed)
 {