[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <10a81412c1ac7549412b11a9aa0b5c70dac5de37.1358331166.git.agordeev@redhat.com>
Date: Wed, 16 Jan 2013 11:14:38 +0100
From: Alexander Gordeev <agordeev@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH -tip] sched: Pair ttwu_activate() with uwtt_deactivate()
Try to make reading of __schedule() bit more easy.
Signed-off-by: Alexander Gordeev <agordeev@...hat.com>
---
kernel/sched/core.c | 42 ++++++++++++++++++++++++------------------
1 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 38413f6..dd54ded 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1272,6 +1272,27 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
wq_worker_waking_up(p, cpu_of(rq));
}
+static void try_to_wake_up_local(struct task_struct *p);
+
+static void uwtt_deactivate(struct rq *rq, struct task_struct *p, int de_flags)
+{
+ deactivate_task(rq, p, de_flags);
+ p->on_rq = 0;
+
+ /*
+ * If a worker went to sleep, notify and ask workqueue
+ * whether it wants to wake up a task to maintain
+ * concurrency.
+ */
+ if (p->flags & PF_WQ_WORKER) {
+ struct task_struct *to_wakeup;
+
+ to_wakeup = wq_worker_sleeping(p, cpu_of(rq));
+ if (to_wakeup)
+ try_to_wake_up_local(to_wakeup);
+ }
+}
+
/*
* Mark the task runnable and perform wakeup-preemption.
*/
@@ -2907,25 +2928,10 @@ need_resched:
switch_count = &prev->nivcsw;
if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
- if (unlikely(signal_pending_state(prev->state, prev))) {
+ if (unlikely(signal_pending_state(prev->state, prev)))
prev->state = TASK_RUNNING;
- } else {
- deactivate_task(rq, prev, DEQUEUE_SLEEP);
- prev->on_rq = 0;
-
- /*
- * If a worker went to sleep, notify and ask workqueue
- * whether it wants to wake up a task to maintain
- * concurrency.
- */
- if (prev->flags & PF_WQ_WORKER) {
- struct task_struct *to_wakeup;
-
- to_wakeup = wq_worker_sleeping(prev, cpu);
- if (to_wakeup)
- try_to_wake_up_local(to_wakeup);
- }
- }
+ else
+ uwtt_deactivate(rq, prev, DEQUEUE_SLEEP);
switch_count = &prev->nvcsw;
}
--
1.7.7.6
--
Regards,
Alexander Gordeev
agordeev@...hat.com
--
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