Messages in this thread Patch in this message | | | Subject | Re: [tip:sched/urgent] cpuset: Fix cpuset_cpus_allowed_fallback(), don't update tsk->rt.nr_cpus_allowed | From | Peter Zijlstra <> | Date | Mon, 20 Jun 2011 12:20:58 +0200 |
| |
On Sat, 2011-05-28 at 16:35 +0000, tip-bot for KOSAKI Motohiro wrote: > +++ b/kernel/kthread.c > @@ -202,8 +202,8 @@ void kthread_bind(struct task_struct *p, unsigned int cpu) > return; > } > > - p->cpus_allowed = cpumask_of_cpu(cpu); > - p->rt.nr_cpus_allowed = 1; > + /* It's safe because the task is inactive. */ > + do_set_cpus_allowed(p, cpumask_of(cpu)); > p->flags |= PF_THREAD_BOUND; > }
I just happened to be staring at this stuff again, and I'm wondering how and why this is correct. After kthread_create() the thread exists and is exposed in the pid-hash, therefore userspace can come and do sys_sched_setaffinity() on it, and since we're not holding any locks and set PF_THREAD_BOUND _after_ setting cpus_allowed, things can end up funny.
Hmm?
| |