Messages in this thread Patch in this message | | | Date | Wed, 16 Jan 2013 11:14:38 +0100 | From | Alexander Gordeev <> | 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@redhat.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@redhat.com
| |