public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: ego@in.ibm.com
Cc: Mike Galbraith <efault@gmx.de>,
	Gregory Haskins <ghaskins@novell.com>,
	Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
	Balbir Singh <balbir@in.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Dipankar Sarma <dipankar@in.ibm.com>,
	Srivatsa Vaddagiri <vatsa@in.ibm.com>
Subject: Re: [PATCH] sched: Fix __load_balance_iterator() for cfq with only one task
Date: Fri, 12 Sep 2008 08:56:15 +0200	[thread overview]
Message-ID: <1221202575.6407.2.camel@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20080912063539.GB4872@in.ibm.com>

On Fri, 2008-09-12 at 12:05 +0530, Gautham R Shenoy wrote:
> On Fri, Sep 05, 2008 at 07:23:44PM +0200, Peter Zijlstra wrote:
> > On Fri, 2008-09-05 at 17:13 +0200, Peter Zijlstra wrote:
> > > On Fri, 2008-09-05 at 18:00 +0530, Gautham R Shenoy wrote:
> > > > sched: Fix __load_balance_iterator() for cfq with only one task.
> > > > 
> > > > From: Gautham R Shenoy <ego@in.ibm.com>
> > > > 
> > > > The __load_balance_iterator() returns a NULL when there's only one
> > > > sched_entity which is a task. It is caused by the following code-path.
> > > > 
> > > > 
> > > > 	/* Skip over entities that are not tasks */
> > > > 	do {
> > > > 		se = list_entry(next, struct sched_entity, group_node);
> > > > 		next = next->next;
> > > > 	} while (next != &cfs_rq->tasks && !entity_is_task(se));
> > > > 
> > > > 	if (next == &cfs_rq->tasks)
> > > > 		return NULL;
> > > > 	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > >       This will return NULL even when se is a task.
> > > > 
> > > > As a side-effect, there was a regression in sched_mc behavior since 2.6.25,
> > > > since iter_move_one_task() when it calls load_balance_start_fair(),
> > > > would not get any tasks to move!
> > > > 
> > > > Fix this by checking if the last entity was a task or not.
> > > 
> > > Gregory did a similar fix a while ago, but that caused grief of some
> > > kind..
> > > 
> > > Greg, can you recollect why we pulled it? I can't seem to find it.
> > 
> > Gregory pointed me to this thread:
> > 
> >   http://lkml.org/lkml/2008/8/11/81
> > 
> > ego, can you run sysbench to confirm?
> 
> Am planning to run it today.
> 
> Mike, with what --oltp-* mode did you run the sysbench test?
> 
> That aside, if Mike's analysis is correct regarding the client/server
> pairs not running on the same CPU as buddies, shouldn't this be fixed in a
> higher level routine rather than have this anomaly in
> __load_balancer_iterator(), which is supposed to return the runnable
> tasks in the cfs_rq ?
> 
> It's current behavior is that __load_balancer_iterator() will
> return NULL even if the last entity in the list is a runnable task.
> 
> This behavior clearly hinders sched_mc powersavings from migrating
> a sole remaining task from a powersavings-sched_domain in-order
> to evacuate that domain and put all the CPUs of the domain into a
> low-power state.

Sure - there is buddy_hot in task_hot() to avoid moving buddies, and I
think we should do something like this:

@@ -590,7 +602,7 @@ account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
                add_cfs_task_weight(cfs_rq, se->load.weight);
        cfs_rq->nr_running++;
        se->on_rq = 1;
-       list_add(&se->group_node, &cfs_rq->tasks);
+       list_add_tail(&se->group_node, &cfs_rq->tasks);
 }

 static void

(most likely whitespace damaged)




  reply	other threads:[~2008-09-12  6:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-05 12:30 [PATCH] sched: Fix __load_balance_iterator() for cfq with only one task Gautham R Shenoy
2008-09-05 15:13 ` Peter Zijlstra
2008-09-05 17:23   ` Peter Zijlstra
2008-09-12  6:35     ` Gautham R Shenoy
2008-09-12  6:56       ` Peter Zijlstra [this message]
2008-09-12  7:05       ` Mike Galbraith
2008-09-12 10:57       ` Mike Galbraith
2008-09-12 11:07         ` Gautham R Shenoy
2008-09-12 15:52 ` Chris Friesen

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=1221202575.6407.2.camel@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=balbir@in.ibm.com \
    --cc=dipankar@in.ibm.com \
    --cc=efault@gmx.de \
    --cc=ego@in.ibm.com \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox