Re: [RFC][PATCH 07/17] sched: Serialize p->cpus_allowed and ttwu()using p->pi_lock

From: Yong Zhang
Date: Wed Dec 29 2010 - 09:20:39 EST


On Fri, Dec 24, 2010 at 01:23:45PM +0100, Peter Zijlstra wrote:
> Currently p->pi_lock already serializes p->sched_class, also put
> p->cpus_allowed and try_to_wake_up() under it, this prepares the way
> to do the first part of ttwu() without holding rq->lock.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> kernel/sched.c | 37 ++++++++++++++++---------------------
> 1 file changed, 16 insertions(+), 21 deletions(-)
>
> Index: linux-2.6/kernel/sched.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -2301,7 +2301,7 @@ void task_oncpu_function_call(struct tas
>
> #ifdef CONFIG_SMP
> /*
> - * ->cpus_allowed is protected by either TASK_WAKING or rq->lock held.
> + * ->cpus_allowed is protected by both rq->lock and p->pi_lock
> */
> static int select_fallback_rq(int cpu, struct task_struct *p)
> {
> @@ -2334,7 +2334,7 @@ static int select_fallback_rq(int cpu, s
> }
>
> /*
> - * The caller (fork, wakeup) owns TASK_WAKING, ->cpus_allowed is stable.
> + * The caller (fork, wakeup) owns p->pi_lock, ->cpus_allowed is stable.

Yes for wakeup, but not true for fork.
I don't see protection in wake_up_new_task().
Or am I missing something?

Thanks,
Yong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/