From: Peter Zijlstra <peterz@infradead.org>
To: Michael Neuling <mikey@neuling.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
ego@in.ibm.com
Subject: Re: [PATCHv4 2/2] powerpc: implement arch_scale_smt_power for Power7
Date: Tue, 02 Mar 2010 15:44:36 +0100 [thread overview]
Message-ID: <1267541076.25158.60.camel@laptop> (raw)
In-Reply-To: <12599.1267266087@neuling.org>
On Sat, 2010-02-27 at 21:21 +1100, Michael Neuling wrote:
> In message <11927.1267010024@neuling.org> you wrote:
> > > > If there's less the group will normally be balanced and we fall out and
> > > > end up in check_asym_packing().
> > > >
> > > > So what I tried doing with that loop is detect if there's a hole in the
> > > > packing before busiest. Now that I think about it, what we need to check
> > > > is if this_cpu (the removed cpu argument) is idle and less than busiest.
> > > >
> > > > So something like:
> > > >
> > > > static int check_asym_pacing(struct sched_domain *sd,
> > > > struct sd_lb_stats *sds,
> > > > int this_cpu, unsigned long *imbalance)
> > > > {
> > > > int busiest_cpu;
> > > >
> > > > if (!(sd->flags & SD_ASYM_PACKING))
> > > > return 0;
> > > >
> > > > if (!sds->busiest)
> > > > return 0;
> > > >
> > > > busiest_cpu = group_first_cpu(sds->busiest);
> > > > if (cpu_rq(this_cpu)->nr_running || this_cpu > busiest_cpu)
> > > > return 0;
> > > >
> > > > *imbalance = (sds->max_load * sds->busiest->cpu_power) /
> > > > SCHED_LOAD_SCALE;
> > > > return 1;
> > > > }
> > > >
> > > > Does that make sense?
> > >
> > > I think so.
> > >
> > > I'm seeing check_asym_packing do the right thing with the simple SMT2
> > > with 1 process case. It marks cpu0 as imbalanced when cpu0 is idle and
> > > cpu1 is busy.
> > >
> > > Unfortunately the process doesn't seem to be get migrated down though.
> > > Do we need to give *imbalance a higher value?
> >
> > So with ego help, I traced this down a bit more.
> >
> > In my simple test case (SMT2, t0 idle, t1 active) if f_b_g() hits our
> > new case in check_asym_packing(), load_balance then runs f_b_q().
> > f_b_q() has this:
> >
> > if (capacity && rq->nr_running == 1 && wl > imbalance)
> > continue;
> >
> > when check_asym_packing() hits, wl = 1783 and imbalance = 1024, so we
> > continue and busiest remains NULL.
> >
> > load_balance then does "goto out_balanced" and it doesn't attempt to
> > move the task.
> >
> > Based on this and on egos suggestion I pulled in Suresh Siddha patch
> > from: http://lkml.org/lkml/2010/2/12/352. This fixes the problem. The
> > process is moved down to t0.
> >
> > I've only tested SMT2 so far.
>
> I'm finding this SMT2 result to be unreliable. Sometimes it doesn't work
> for the simple 1 process case. It seems to change boot to boot.
> Sometimes it works as expected with t0 busy and t1 idle, but other times
> it's the other way around.
>
> When it doesn't work, check_asym_packing() is still marking processes to
> be pulled down but only gets run about 1 in every 4 calls to
> load_balance().
>
> For 2 of the other calls to load_balance, idle is CPU_NEWLY_IDLE and
> hence check_asym_packing() doesn't get called. This results in
> sd->nr_balance_failed being reset. When load_balance is next called and
> check_asym_packing() hits, need_active_balance() returns 0 as
> sd->nr_balance_failed is too small. This means the migration thread on
> t1 is not woken and the process remains there.
>
> So why does thread0 change from NEWLY_IDLE to IDLE and visa versa, when
> there is nothing running on it? Is this expected?
Ah, yes, you should probably allow both those.
NEWLY_IDLE is when we are about to schedule the idle thread, IDLE is
when a tick hits the idle thread.
I'm thinking that NEWLY_IDLE should also solve the NO_HZ case, since
we'll have passed through that before we enter tickless state, just make
sure SD_BALANCE_NEWIDLE is set on the relevant levels (should already be
so).
next prev parent reply other threads:[~2010-03-02 14:44 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 20:00 [PATCH 0/2] sched: arch_scale_smt_powers Joel Schopp
2010-01-20 20:02 ` [PATCH 1/2] sched: Fix the place where group powers are updated Joel Schopp
2010-01-26 23:28 ` [PATCHv2 1/2] sched: enable ARCH_POWER Joel Schopp
2010-01-28 23:20 ` [PATCHv3 " Joel Schopp
2010-02-05 20:57 ` [PATCHv4 " Joel Schopp
2010-01-20 20:04 ` [PATCH 2/2] powerpc: implement arch_scale_smt_power for Power7 Joel Schopp
2010-01-20 20:48 ` Peter Zijlstra
2010-01-20 21:58 ` Michael Neuling
2010-01-20 22:44 ` Joel Schopp
2010-01-21 8:27 ` Peter Zijlstra
2010-01-20 21:04 ` Michael Neuling
2010-01-20 22:09 ` Joel Schopp
2010-01-24 3:00 ` Benjamin Herrenschmidt
2010-01-25 17:50 ` Joel Schopp
2010-01-26 4:23 ` Benjamin Herrenschmidt
2010-01-20 21:33 ` Benjamin Herrenschmidt
2010-01-20 22:36 ` Joel Schopp
2010-01-26 23:28 ` [PATCHv2 " Joel Schopp
2010-01-27 0:52 ` Benjamin Herrenschmidt
2010-01-28 22:39 ` Joel Schopp
2010-01-29 1:23 ` Benjamin Herrenschmidt
2010-01-28 23:20 ` [PATCHv3 " Joel Schopp
2010-01-28 23:24 ` Joel Schopp
2010-01-29 1:23 ` Benjamin Herrenschmidt
2010-01-29 10:13 ` Peter Zijlstra
2010-01-29 18:34 ` Joel Schopp
2010-01-29 18:41 ` Joel Schopp
2010-02-05 20:57 ` [PATCHv4 " Joel Schopp
2010-02-14 10:12 ` Peter Zijlstra
2010-02-17 22:20 ` Michael Neuling
2010-02-18 13:17 ` Peter Zijlstra
2010-02-18 13:19 ` Peter Zijlstra
2010-02-18 16:28 ` Joel Schopp
2010-02-18 17:08 ` Peter Zijlstra
2010-02-19 6:05 ` Michael Neuling
2010-02-19 10:01 ` Peter Zijlstra
2010-02-19 11:01 ` Michael Neuling
2010-02-23 6:08 ` Michael Neuling
2010-02-23 16:24 ` Peter Zijlstra
2010-02-23 16:30 ` Peter Zijlstra
2010-02-24 6:07 ` Michael Neuling
2010-02-24 11:13 ` Michael Neuling
2010-02-24 11:58 ` Michael Neuling
2010-02-27 10:21 ` Michael Neuling
2010-03-02 14:44 ` Peter Zijlstra [this message]
2010-03-04 22:28 ` Michael Neuling
2010-01-29 12:25 ` [PATCHv3 " Gabriel Paubert
2010-01-29 16:26 ` Joel Schopp
2010-01-26 23:27 ` [PATCHv2 0/2] sched: arch_scale_smt_powers v2 Joel Schopp
2010-01-28 23:20 ` [PATCHv3 0/2] sched: arch_scale_smt_powers Joel Schopp
2010-02-05 20:57 ` [PATCHv4 " Joel Schopp
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=1267541076.25158.60.camel@laptop \
--to=peterz@infradead.org \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mingo@elte.hu \
/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;
as well as URLs for NNTP newsgroup(s).