LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>, Ken Chen <kenchen@google.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Mike Galbraith <efault@gmx.de>
Subject: Re: [patch] restore sched_exec load balance heuristics
Date: Mon, 10 Nov 2008 10:29:37 +0100 [thread overview]
Message-ID: <20081110092937.GJ22392@elte.hu> (raw)
In-Reply-To: <1226307053.2697.3993.camel@twins>
* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> void sched_exec(void)
> {
> int new_cpu, this_cpu = get_cpu();
> - new_cpu = sched_balance_self(this_cpu, SD_BALANCE_EXEC);
> + struct task_group *tg;
> + long weight, eload;
> +
> + tg = task_group(current);
> + weight = current->se.load.weight;
> + eload = -effective_load(tg, this_cpu, -weight, -weight);
> +
> + new_cpu = sched_balance_self(this_cpu, SD_BALANCE_EXEC, eload);
okay, i think this will work.
it feels somewhat backwards though on a conceptual level.
There's nothing particularly special about exec-balancing: the load
picture is in equilibrium - it is in essence a rebalancing pass done
not in the scheduler tick but in a special place in the middle of
exec() where the old-task / new-task cross section is at a minimum
level.
_fork_ balancing is what is special: there we'll get a new context so
we have to take the new load into account. It's a bit like wakeup
balancing. (just done before the new task is truly woken up)
OTOH, triggering the regular busy-balance at exec() time isnt totally
straightforward either: the 'old' task is the current task so it
cannot be balanced away. We have to trigger all the active-migration
logic - which again makes exec() balancing special.
So maybe this patch is the best solution after all. Ken, does it do
the trick for your workload, when applied against v2.6.28-rc4?
You might even try to confirm that your testcase still works fine even
if you elevate the load average with +1.0 on every cpu by starting
infinite CPU eater loops on every CPU, via this bash oneliner:
for ((i=0;i<2;i++)); do while :; do :; done & done
(change the '2' to '4' if you test this on a quad, not on a dual-core
box)
the desired behavior would be for your "exec hopper" testcase to not
hop between cpus, but to stick the same CPU most of the time.
Ingo
next prev parent reply other threads:[~2008-11-10 9:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 19:40 [patch] restore sched_exec load balance heuristics Ken Chen
2008-11-06 20:07 ` Ingo Molnar
2008-11-06 20:32 ` Ken Chen
2008-11-06 20:38 ` Ingo Molnar
2008-11-06 20:49 ` Chris Friesen
2008-11-10 8:50 ` Peter Zijlstra
2008-11-10 9:29 ` Ingo Molnar [this message]
2008-11-10 12:54 ` Peter Zijlstra
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=20081110092937.GJ22392@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=kenchen@google.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).