From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com,
joel@joelfernandes.org
Subject: Re: [PATCH 1/2] sched/fair: skip newidle update stats
Date: Fri, 12 Nov 2021 15:55:27 +0100 [thread overview]
Message-ID: <YY6AXx2lhJ27IBuJ@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YY6ARaFrpuWYqege@hirez.programming.kicks-ass.net>
Subject: sched/fair: Reflow newidle_balance()
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri Nov 12 15:46:08 CET 2021
The control flow in newidle_balance() is a little convoluted, attempt
simplification.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/sched/fair.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10858,10 +10858,10 @@ static inline void nohz_newidle_balance(
static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
{
unsigned long next_balance = jiffies + HZ;
+ int pulled_task = 0, timeout = 0;
int this_cpu = this_rq->cpu;
u64 t0, t1, curr_cost = 0;
struct sched_domain *sd;
- int pulled_task = 0, early_stop = 0;
update_misfit_status(NULL, this_rq);
@@ -10889,17 +10889,9 @@ static int newidle_balance(struct rq *th
if (!READ_ONCE(this_rq->rd->overload) ||
(sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) {
- if (sd) {
+ if (sd)
update_next_balance(sd, &next_balance);
- /*
- * We skip new idle LB because there is not enough
- * time before next wake up. Make sure that we will
- * not kick NOHZ_NEWILB_KICK
- */
- early_stop = 1;
- }
-
goto out;
}
@@ -10922,7 +10914,7 @@ static int newidle_balance(struct rq *th
update_next_balance(sd, &next_balance);
if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
- early_stop = 1;
+ timeout = 1;
break;
}
@@ -10967,6 +10959,11 @@ static int newidle_balance(struct rq *th
if (this_rq->nr_running != this_rq->cfs.h_nr_running)
pulled_task = -1;
+ if (pulled_task || timeout)
+ goto out;
+
+ nohz_newidle_balance(this_rq);
+
out:
/* Move the next balance forward */
if (time_after(this_rq->next_balance, next_balance))
@@ -10974,8 +10971,6 @@ static int newidle_balance(struct rq *th
if (pulled_task)
this_rq->idle_stamp = 0;
- else if (!early_stop)
- nohz_newidle_balance(this_rq);
return pulled_task;
}
next prev parent reply other threads:[~2021-11-12 14:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 9:58 [PATCH 0/2] avoid spurious blocked load update Vincent Guittot
2021-11-12 9:58 ` [PATCH 1/2] sched/fair: skip newidle update stats Vincent Guittot
2021-11-12 14:29 ` Peter Zijlstra
2021-11-12 14:47 ` Vincent Guittot
2021-11-12 15:29 ` Peter Zijlstra
2021-11-12 16:00 ` Vincent Guittot
2021-11-12 14:55 ` Peter Zijlstra
2021-11-12 14:55 ` Peter Zijlstra [this message]
2021-11-12 16:05 ` Vincent Guittot
2021-11-16 23:48 ` [PATCH 0/2] avoid spurious blocked load update Tim Chen
2021-11-18 14:40 ` Vincent Guittot
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=YY6AXx2lhJ27IBuJ@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.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