[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130715201945.GQ17211@twins.programming.kicks-ass.net>
Date: Mon, 15 Jul 2013 22:19:45 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kirill Tkhai <tkhai@...dex.ru>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] sched: Add logic to handle parallel try_to_wake_up() of
the same task
On Mon, Jul 15, 2013 at 06:14:34PM +0400, Kirill Tkhai wrote:
> >>
> >> #ifdef CONFIG_SMP
> >> + p->state = TASK_WAKING;
> >> + smp_wmb();
> >> +
> >
> > This too is broken; the loop below needs to be completed first,
> > otherwise we change p->state while the task is still on the CPU and it
> > might read the wrong p->state.
>
> This place is below (on_rq && ttwu_remote) check, so the task
> either 'dequeued and on_cpu == 0'
> or it's in the middle of schedule() on arch, which wants unlocked
> context switch.
>
> Nobody scheduler's probes p->state between prepare_lock_switch() and
> finish_lock_switch(). Archs with unlocked ctx switch (mips and ia64)
> don't change or probe state of previous process during context_switch.
It means its after deactivate_task(), but before context_switch(). It so
happens that
context_switch()->prepare_task_switch()->trace_sched_switch() inspects
p->state.
Even if this was not the case, touching a task that is 'life' on another
CPU is very _very_ bad practise.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists