LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: Ken Chen <kenchen@google.com>,
	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 13:54:08 +0100	[thread overview]
Message-ID: <1226321648.7685.74.camel@twins> (raw)
In-Reply-To: <20081110092937.GJ22392@elte.hu>

On Mon, 2008-11-10 at 10:29 +0100, Ingo Molnar wrote:
> * 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. 

Even worse, you want to balance current, the generic load balance might
pick two cpus to balance neither of which will have current on it. But
even if it would pick the queue with current on it as busiest, there is
no saying you'll actually end up moving current.

So this specialized form of moving current to a possibly more idle cpu
is afaics the best solution for balancing a particular task.


      reply	other threads:[~2008-11-10 12:54 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
2008-11-10 12:54       ` 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=1226321648.7685.74.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=efault@gmx.de \
    --cc=kenchen@google.com \
    --cc=linux-kernel@vger.kernel.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).