From: Mike Galbraith <bitbucket@online.de>
To: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH -tip] sched: Pair ttwu_activate() with uwtt_deactivate()
Date: Wed, 16 Jan 2013 16:05:58 +0100 [thread overview]
Message-ID: <1358348758.4643.42.camel@marge.simpson.net> (raw)
In-Reply-To: <10a81412c1ac7549412b11a9aa0b5c70dac5de37.1358331166.git.agordeev@redhat.com>
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@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
>
>
prev parent reply other threads:[~2013-01-16 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 10:14 [PATCH -tip] sched: Pair ttwu_activate() with uwtt_deactivate() Alexander Gordeev
2013-01-16 15:05 ` Mike Galbraith [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358348758.4643.42.camel@marge.simpson.net \
--to=bitbucket@online.de \
--cc=agordeev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox