From: Peter Zijlstra <peterz@infradead.org>
To: Paul Turner <pjt@google.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Srivatsa Vaddagiri <vatsa@in.ibm.com>,
Chris Friesen <cfriesen@nortel.com>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Pierre Bourdon <pbourdon@excellency.fr>
Subject: Re: [RFC][PATCH 3/3] sched: On-demand tg_shares_up()
Date: Fri, 03 Sep 2010 09:59:36 +0200 [thread overview]
Message-ID: <1283500776.1783.136.camel@laptop> (raw)
In-Reply-To: <AANLkTi=w8MUhf3_=ADzPX1gPycYrQkGywQSAm6cLeidE@mail.gmail.com>
On Fri, 2010-09-03 at 02:52 +0100, Paul Turner wrote:
> > +static void update_shares(int cpu)
> > +{
> > + struct cfs_rq *cfs_rq;
> > + struct rq *rq = cpu_rq(cpu);
> > +
> > + rcu_read_lock();
> > + for_each_leaf_cfs_rq(rq, cfs_rq) {
> > + struct task_group *tg = cfs_rq->tg;
> > +
> > + do {
> > + tg_shares_up(tg, cpu);
> > + tg = tg->parent;
> > + } while (tg);
> > + }
>
> This will multiply visit taskgroups:
>
> In the case of a-b-task, both {a} and {b} will be on the leaf cfs_rq
> list. Resulting in a being visited both as b's parent and as a leaf
> entity.
>
> Rather than juggling to avoid this, it seems easier to maintain an
> ordering on rq->leaf_cfs_rq_list.
>
> That is:
>
> When an entity is added:
> a) If it has a parent, insert it immediately before the parent in the list.
> b) Otherwise it is attached to the root, attach it to the tail of
> rq->leaf_cfs_rq_list
>
> This can actually be simplified to: if no parent insert at the tail,
> otherwise insert at the head, since we know the parent will always
> have been processed prior to the child.
Except we enqueue things bottom up, so: A-B-C-task would end up as:
add(C) - has parent on head: C
add(B) - has parent on head: B-C
add(A) - has no parent, on tail: B-C-A
Whereas we'd wanted: C-B-A
Which also means your rule (a) doens't work, can't enqueue it before the
parent if the parent itself isn't yet enqueued.
> Traversing the list in order should then ensure that all child
> entities have been processed for the 'next' entity at any given time
> and that its update is coherent.
Right. I'm sure we can get something like this to work, just need to
come up with something that actually works, and a cold has currently
stopped everything but the very basic brain functions :/
prev parent reply other threads:[~2010-09-03 7:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-28 22:30 [RFC][PATCH 0/3] Try and make cpu-cgroup suck less Peter Zijlstra
2010-08-28 22:30 ` [RFC][PATCH 1/3] sched: Rewrite tg_shares_up Peter Zijlstra
2010-08-30 17:20 ` Srivatsa Vaddagiri
2010-08-30 17:53 ` Peter Zijlstra
2010-09-03 3:09 ` Paul Turner
2010-09-03 7:59 ` Peter Zijlstra
2010-08-28 22:30 ` [RFC][PATCH 2/3] sched: On-demand cfs_rq list Peter Zijlstra
2010-09-03 3:33 ` Paul Turner
2010-09-03 7:59 ` Peter Zijlstra
2010-08-28 22:30 ` [RFC][PATCH 3/3] sched: On-demand tg_shares_up() Peter Zijlstra
2010-09-03 1:52 ` Paul Turner
2010-09-03 7:59 ` Peter Zijlstra [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=1283500776.1783.136.camel@laptop \
--to=peterz@infradead.org \
--cc=cfriesen@nortel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=pbourdon@excellency.fr \
--cc=pjt@google.com \
--cc=svaidy@linux.vnet.ibm.com \
--cc=vatsa@in.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.