23.09.2014, 19:06, "Peter Zijlstra" <[email protected]>:
> On Mon, Sep 22, 2014 at 10:36:18PM +0400, Kirill Tkhai wrote:
>>  From: Kirill Tkhai <[email protected]>
>>
>>  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 <[email protected]>
> Cc: Guenter Roeck <[email protected]>
> Cc: Ralf Baechle <[email protected]>
> Cc: Tony Luck <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

Reviewed-by: Kirill Tkhai <[email protected]> (one more review of ia64 part)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to