23.09.2014, 19:06, "Peter Zijlstra" <peterz@xxxxxxxxxxxxx>: > On Mon, Sep 22, 2014 at 10:36:18PM +0400, Kirill Tkhai wrote: >> From: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> >> >> Architectures, which define __ARCH_WANT_UNLOCKED_CTXSW, >> may pull a task when it's in the middle of schedule(). >> >> CPU1(task1 calls schedule) CPU2 >> ... schedule() >> ... idle_balance() >> ... load_balance() >> ... ... >> schedule() ... >> prepare_lock_switch() ... >> raw_spin_unlock(&rq1->lock) ... >> ... raw_spin_lock(&rq1->lock) >> ... detach_tasks(); >> ... can_migrate_task(task1) >> ... attach_tasks(); <--- move task1 to rq2 >> ... raw_spin_unlock(&rq1->lock) >> ... context_switch() <--- switch to task1's stack >> ... ... >> (using task1's stack) (using task1's stack) >> ... ... >> context_switch() ... >> >> Parallel use of a single stack is not a good idea. > > Indeed it is, but how about we do this instead? Completely agree, looks good for me. > --- > Subject: sched,mips,ia64: Remove __ARCH_WANT_UNLOCKED_CTXSW > > Kirill found that there's a subtle race in the > __ARCH_WANT_UNLOCKED_CTXSW code, and instead of fixing it, remove the > entire exception because neither arch that uses it seems to actually > still require it. > > Boot tested on mips64el (qemu) only. > > Cc: Oleg Nesterov <oleg@xxxxxxxxxx> > Cc: Guenter Roeck <linux@xxxxxxxxxxxx> > Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx> > Cc: Tony Luck <tony.luck@xxxxxxxxx> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Reviewed-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> (one more review of ia64 part)