mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Paul Turner <pjt@google.com>
Cc: Lei Wen <adrian.wenl@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>, Lei Wen <leiwen@marvell.com>
Subject: Re: false nr_running check in load balance?
Date: Thu, 15 Aug 2013 20:39:49 +0200	[thread overview]
Message-ID: <20130815183949.GW24092@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAPM31RLqDC4HpkhV_E83Ny3m6MpGdOjuUswEQTdy58AtVP3z_w@mail.gmail.com>

On Thu, Aug 15, 2013 at 11:23:53AM -0700, Paul Turner wrote:
> On Thu, Aug 15, 2013 at 10:39 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Tue, Aug 13, 2013 at 01:08:17AM -0700, Paul Turner wrote:
> >> On Tue, Aug 13, 2013 at 12:38 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >> > On Tue, Aug 13, 2013 at 12:45:12PM +0800, Lei Wen wrote:
> >> >> > Not quite right; I think you need busiest->cfs.h_nr_running.
> >> >> > cfs.nr_running is the number of entries running in this 'group'. If
> >> >> > you've got nested groups like:
> >> >> >
> >> >> >  'root'
> >> >> >    \
> >> >> >    'A'
> >> >> >    / \
> >> >> >   t1 t2
> >> >> >
> >> >> > root.nr_running := 1 'A', even though you've got multiple running tasks.
> >
> > One thing though; doesn't h_nr_running over count the number of tasks?
> > That is, doesn't it count the runnable entities so the above case would
> > give root.h_nr_running := 3, where we would only have 2 runnable tasks.
> >
> > Double check this and be careful when doing the conversion.
> 
> This should be ok: it's accounted like rq->nr_running, not cfs_rq->nr_running.
> Specifically: both only account tasks; group-entities do not contribute.

Ah, ok. I should have looked at the code I guess... :-)

> The fact that this distinction exists, despite the very similar names
> is unfortunate.
> We could consider renaming to h_nr_{running_,}tasks for clarity.
> The same applies to rq->nr_running, although that would involve more churn.

Yah.. that would clarify, although longer variable names will also get
us into more line-breaks I'm sure.

Lets keep it as is. Maybe a comment somewhere would be enough.

      reply	other threads:[~2013-08-15 18:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 13:23 Lei Wen
2013-08-12 14:43 ` Peter Zijlstra
2013-08-13  4:45   ` Lei Wen
2013-08-13  7:38     ` Peter Zijlstra
2013-08-13  8:08       ` Paul Turner
2013-08-13  8:18         ` Lei Wen
2013-08-13  9:25           ` Paul Turner
2013-08-18  9:12             ` Lei Wen
2013-08-15 17:39         ` Peter Zijlstra
2013-08-15 18:23           ` Paul Turner
2013-08-15 18:39             ` 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=20130815183949.GW24092@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=adrian.wenl@gmail.com \
    --cc=leiwen@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pjt@google.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

Powered by JetHome