lkml.org 
[lkml]   [2014]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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.
> .
>



\
 
 \ /
  Last update: 2014-04-16 13:41    [W:0.188 / U:1.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site