From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [Question] sched: Should nr_uninterruptible be decremented in ttwu_do_activate()?
Date: Thu, 12 Jan 2012 08:25:30 +0100 [thread overview]
Message-ID: <1326353130.2442.177.camel@twins> (raw)
In-Reply-To: <CADZ9YHiC8732D=D8KpkT0d+81_BNdAvj0ZJLwL5mhyq9OPLW0Q@mail.gmail.com>
On Thu, 2012-01-12 at 12:09 +0600, Rakib Mullick wrote:
> On Wed, Jan 11, 2012 at 11:29 PM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > On Wed, 2012-01-11 at 23:22 +0600, Rakib Mullick wrote:
> >> Hello all,
> >>
> >> In ttwu_do_activate(), we're decrementing nr_uninterruptible if
> >> p->sched_contributes_to_load (for SMP=y). But, we're also decrementing
> >> nr_uninterruptible from activate_task at the same path. Why we're
> >> doing it twice for a single task activation path?
> >
> > activate_task() does:
> >
> > if (task_contributes_to_load(p))
> > rq->nr_uninterruptible--;
> >
> > Now task_contributes_to_load() reads like:
> >
> > #define task_contributes_to_load(task) \
> > ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
> > (task->flags & PF_FREEZING) == 0)
> >
> > which will be false, since we've set TASK_WAKING.
>
> Enough confusing. TASK_WAKING will be set when called from
> try_to_wake_up(). ttwu_do_activate() gets called from other places:
> scheduler_ipi() and sched_ttwu_pending() (at the time of cpu goes
> down). TASK_WAKING will be not set at that time,
Yes it will be, the only way to get on that list is throught
ttwu_queue_remote() at which point tasks are TASK_WAKING.
> moreover it is
> possible that, task has p->sched_contributes_to_load is set and latter
> on gets wake up by sched_ttwu_pending/scheduler_ipi() call.
That's the entire point. But all ways to ttwu_queue_remote() explicitly
set ->sched_contributes_to_load.
next prev parent reply other threads:[~2012-01-12 7:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 17:22 [Question] sched: Should nr_uninterruptible be decremented in ttwu_do_activate()? Rakib Mullick
2012-01-11 17:29 ` Peter Zijlstra
2012-01-12 6:09 ` Rakib Mullick
2012-01-12 7:25 ` Peter Zijlstra [this message]
2012-01-12 17:08 ` Rakib Mullick
2012-01-12 20:25 ` Peter Zijlstra
2012-01-16 7:53 ` Michael Wang
2012-01-16 8:27 ` Rakib Mullick
2012-01-16 9:22 ` Michael Wang
2012-01-16 17:22 ` Rakib Mullick
2012-01-16 13:00 ` Hillf Danton
2012-01-16 17:26 ` Rakib Mullick
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=1326353130.2442.177.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rakib.mullick@gmail.com \
/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