From: Jason Low <jason.low2@hp.com>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Andi Kleen <andi@firstfloor.org>,
Michel Lespinasse <walken@google.com>,
Rik van Riel <riel@redhat.com>,
Peter Hurley <peter@hurleysoftware.com>,
Davidlohr Bueson <davidlohr@hp.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: Fast idling of CPU when system is partially loaded
Date: Fri, 13 Jun 2014 12:18:47 -0700 [thread overview]
Message-ID: <1402687127.2431.6.camel@j-VirtualBox> (raw)
In-Reply-To: <1402676882.2970.564.camel@schen9-DESK>
On Fri, 2014-06-13 at 09:28 -0700, Tim Chen wrote:
> On Thu, 2014-06-12 at 23:01 -0700, Jason Low wrote:
> > On Thu, 2014-06-12 at 14:25 -0700, Tim Chen wrote:
> >
> > > Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
> > > ---
> > > kernel/sched/core.c | 12 ++++++++----
> > > kernel/sched/fair.c | 23 +++++++++++++++++++++--
> > > kernel/sched/sched.h | 10 ++++++++--
> > > 3 files changed, 37 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index c6b9879..4f57221 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -2630,7 +2630,7 @@ static inline struct task_struct *
> > > pick_next_task(struct rq *rq, struct task_struct *prev)
> > > {
> > > const struct sched_class *class = &fair_sched_class;
> > > - struct task_struct *p;
> > > + struct task_struct *p = NULL;
> > >
> > > /*
> > > * Optimization: we know that if all tasks are in
> > > @@ -2638,9 +2638,13 @@ pick_next_task(struct rq *rq, struct task_struct *prev)
> > > */
> > > if (likely(prev->sched_class == class &&
> > > rq->nr_running == rq->cfs.h_nr_running)) {
> > > - p = fair_sched_class.pick_next_task(rq, prev);
> > > - if (unlikely(p == RETRY_TASK))
> > > - goto again;
> > > +
> > > + /* If no cpu has more than 1 task, skip */
> > > + if (rq->nr_running > 0 || rq->rd->overload) {
> >
> > Hi Tim,
> >
> > If it is skipping if no cpu has more than 1 task, should the
> > above have the additional check for (rq->nr_running > 1) instead
> > of (rq->nr_running > 0)?
>
> If you have a job on your local cpu, you do want to have the scheduler
> pick the task to run.
I see. In that case, if a CPU is going idle, it still needs to call
idle_balance() to update rq->idle_stamp and rq->next_balance (even if we
skip calling the expensive load_balance).
What do you think about moving the overload check to the top of
idle_balance():
this_rq->idle_stamp = rq_clock(this_rq);
- if (this_rq->avg_idle < sysctl_sched_migration_cost) {
+ if (this_rq->avg_idle < sysctl_sched_migration_cost ||
+ !this_rq->rd->overload) {
rcu_read_lock();
sd = rcu_dereference_check_sched_domain(this_rq->sd);
if (sd)
next prev parent reply other threads:[~2014-06-13 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-12 21:25 [PATCH] sched: Fast idling of CPU when system is partially loaded Tim Chen
2014-06-13 6:01 ` Jason Low
2014-06-13 16:28 ` Tim Chen
2014-06-13 19:18 ` Jason Low [this message]
2014-06-13 20:17 ` Tim Chen
2014-06-15 16:19 ` Peter Zijlstra
2014-06-16 15:50 ` Tim Chen
2014-06-17 12:09 ` 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=1402687127.2431.6.camel@j-VirtualBox \
--to=jason.low2@hp.com \
--cc=andi@firstfloor.org \
--cc=davidlohr@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peter@hurleysoftware.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=tim.c.chen@linux.intel.com \
--cc=walken@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.