Messages in this thread Patch in this message | | | From | Dongsheng Yang <> | Subject | [PATCH 4/8] sched/core: Skip wakeup when task is already running. | Date | Tue, 15 Apr 2014 21:32:53 +0900 |
| |
From: Dongsheng <yangds.fnst@cn.fujitsu.com>
It is pointless to wake up a running task. Currently, we can see it in perf sched latency.
# perf sched record sleep 10 [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 21.170 MB perf.data (~924950 samples) ] # perf sched latency |tail ksoftirqd/13:57 | 0.011 ms | 1 | avg: 0.003 ms | max: 0.003 ms | max at: 254123.512011 s khelper:6423 | 0.059 ms | 3 | avg: 0.003 ms | max: 0.005 ms | max at: 254124.947110 s ksoftirqd/3:17 | 0.042 ms | 2 | avg: 0.003 ms | max: 0.003 ms | max at: 254126.478175 s automount:6465 | 0.480 ms | 1 | avg: 0.000 ms | max: 0.000 ms | max at: 0.000000 s automount:6618 | 0.465 ms | 1 | avg: 0.000 ms | max: 0.000 ms | max at: 0.000000 s ----------------------------------------------------------------------------------------- TOTAL: | 3535.020 ms | 28477 | --------------------------------------------------- INFO: 0.922% state machine bugs (259 out of 28092)
Signed-off-by: Dongsheng <yangds.fnst@cn.fujitsu.com> --- kernel/sched/core.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 268a45e..fc6b644 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1416,6 +1416,9 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags) static void ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) { + if (p->state == TASK_RUNNING) + return; + check_preempt_curr(rq, p, wake_flags); trace_sched_wakeup(p, true); -- 1.8.2.1
| |