[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1358348758.4643.42.camel@marge.simpson.net>
Date: Wed, 16 Jan 2013 16:05:58 +0100
From: Mike Galbraith <bitbucket@...ine.de>
To: Alexander Gordeev <agordeev@...hat.com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH -tip] sched: Pair ttwu_activate() with uwtt_deactivate()
On Wed, 2013-01-16 at 11:14 +0100, Alexander Gordeev wrote:
> Try to make reading of __schedule() bit more easy.
You didn't succeed in doing that for me. Moving that code away just
obfuscates the special case for worker-bees scheduling off, and while
ttwu is shorthand for try_to_wake_up, uuwt is.. a lysdexic typo.
> 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
>
>
--
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