]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - kernel/cgroup/cpuset.c
cpuset: restore sanity to cpuset_cpus_allowed_fallback()
[thirdparty/kernel/stable.git] / kernel / cgroup / cpuset.c
index 4834c4214e9cd15f2122b4747b31a66e5b632df9..6c9deb2cc68731b271b9486d7c117a2484669124 100644 (file)
@@ -3255,10 +3255,23 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
        spin_unlock_irqrestore(&callback_lock, flags);
 }
 
+/**
+ * cpuset_cpus_allowed_fallback - final fallback before complete catastrophe.
+ * @tsk: pointer to task_struct with which the scheduler is struggling
+ *
+ * Description: In the case that the scheduler cannot find an allowed cpu in
+ * tsk->cpus_allowed, we fall back to task_cs(tsk)->cpus_allowed. In legacy
+ * mode however, this value is the same as task_cs(tsk)->effective_cpus,
+ * which will not contain a sane cpumask during cases such as cpu hotplugging.
+ * This is the absolute last resort for the scheduler and it is only used if
+ * _every_ other avenue has been traveled.
+ **/
+
 void cpuset_cpus_allowed_fallback(struct task_struct *tsk)
 {
        rcu_read_lock();
-       do_set_cpus_allowed(tsk, task_cs(tsk)->effective_cpus);
+       do_set_cpus_allowed(tsk, is_in_v2_mode() ?
+               task_cs(tsk)->cpus_allowed : cpu_possible_mask);
        rcu_read_unlock();
 
        /*