Messages in this thread Patch in this message | | | Date | Wed, 16 Apr 2014 19:22:52 +0900 | From | Dongsheng Yang <> | Subject | Re: [PATCH 4/8] sched/core: Skip wakeup when task is already running. |
| |
On 04/15/2014 10:53 PM, Peter Zijlstra wrote: > On Tue, Apr 15, 2014 at 09:32:53PM +0900, Dongsheng Yang wrote: > > How can you get there with ->state == RUNNING? try_to_wake_up*() bail > when !(->state & state). Yes, try_to_wake_up() did this check. But other callers would miss it.
With the following code ,I can get the actual message of waking up a running task
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9f63275..1369cae 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1418,8 +1418,10 @@ static void ttwu_activate(struct rq *rq, struct task_stru static void ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) { - if (p->state == TASK_RUNNING) + if (p->state == TASK_RUNNING) { + printk("Wakeup a running task."); return; + }
check_preempt_curr(rq, p, wake_flags); trace_sched_wakeup(p, true);
# grep "Wakeup" /var/log/messages Apr 15 20:16:21 localhost kernel: [ 5.436505] Wakeup a running task. Apr 15 20:16:21 localhost kernel: [ 7.776042] Wakeup a running task. Apr 15 20:16:21 localhost kernel: [ 9.324274] Wakeup a running task.
So, I think there are some caller of ttwu_do_wakeup() is attempt to wake up a running task. > . >
| |