From: Ingo Molnar Date: Thu, 12 May 2016 07:51:36 +0000 (+0200) Subject: Merge branch 'smp/hotplug' into sched/core, to resolve conflicts X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=4eb867651721228ee2eeae142c53378375303e8b;p=openwrt%2Fstaging%2Fblogic.git Merge branch 'smp/hotplug' into sched/core, to resolve conflicts Conflicts: kernel/sched/core.c Signed-off-by: Ingo Molnar --- 4eb867651721228ee2eeae142c53378375303e8b diff --cc kernel/sched/core.c index e09f92c3a096,9c710ad0ac22..1e622f254df4 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@@ -1150,13 -1051,21 +1119,21 @@@ void do_set_cpus_allowed(struct task_st static int __set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask, bool check) { + const struct cpumask *cpu_valid_mask = cpu_active_mask; unsigned int dest_cpu; - unsigned long flags; + struct rq_flags rf; struct rq *rq; int ret = 0; - rq = task_rq_lock(p, &flags); + rq = task_rq_lock(p, &rf); + if (p->flags & PF_KTHREAD) { + /* + * Kernel threads are allowed on online && !active CPUs + */ + cpu_valid_mask = cpu_online_mask; + } + /* * Must re-check here, to close a race against __kthread_bind(), * sched_setaffinity() is not guaranteed to observe the flag.