From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org,
valentin.schneider@arm.com, Morten.Rasmussen@arm.com
Subject: Re: [PATCH 3/3] sched/fair: fix unnecessary increase of balance interval
Date: Thu, 13 Dec 2018 14:52:08 +0100 [thread overview]
Message-ID: <20181213135208.GI5289@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1533657387-29039-4-git-send-email-vincent.guittot@linaro.org>
On Tue, Aug 07, 2018 at 05:56:27PM +0200, Vincent Guittot wrote:
> +static inline bool
> +asym_active_balance(enum cpu_idle_type idle, unsigned int flags, int dst, int src)
> {
> + if (idle != CPU_NOT_IDLE) {
>
> /*
> * ASYM_PACKING needs to force migrate tasks from busy but
> * lower priority CPUs in order to pack all tasks in the
> * highest priority CPUs.
> */
> + if ((flags & SD_ASYM_PACKING) &&
> + sched_asym_prefer(dst, src))
> + return true;
> }
>
> + return false;
> +}
> +
> +static int need_active_balance(struct lb_env *env)
> +{
> + struct sched_domain *sd = env->sd;
> +
> +
> + if (asym_active_balance(env->idle, sd->flags, env->dst_cpu, env->src_cpu))
> + return 1;
> +
> /*
> * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
> * It's worth migrating the task if the src_cpu's capacity is reduced
> @@ -8650,7 +8660,8 @@ static int load_balance(int this_cpu, struct rq *this_rq,
> } else
> sd->nr_balance_failed = 0;
>
> + if (likely(!active_balance) ||
> + asym_active_balance(env.idle, sd->flags, env.dst_cpu, env.src_cpu)) {
Perhaps like the below?
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8857,21 +8857,24 @@ static struct rq *find_busiest_queue(str
*/
#define MAX_PINNED_INTERVAL 512
+static inline bool
+asym_active_balance(struct lb_env *env)
+{
+ /*
+ * ASYM_PACKING needs to force migrate tasks from busy but
+ * lower priority CPUs in order to pack all tasks in the
+ * highest priority CPUs.
+ */
+ return env->idle != CPU_NOT_IDLE && (env->sd->flags & SD_ASYM_PACKING) &&
+ sched_asym_prefer(env->dst_cpu, env->src_cpu);
+}
+
static int need_active_balance(struct lb_env *env)
{
struct sched_domain *sd = env->sd;
- if (env->idle != CPU_NOT_IDLE) {
-
- /*
- * ASYM_PACKING needs to force migrate tasks from busy but
- * lower priority CPUs in order to pack all tasks in the
- * highest priority CPUs.
- */
- if ((sd->flags & SD_ASYM_PACKING) &&
- sched_asym_prefer(env->dst_cpu, env->src_cpu))
- return 1;
- }
+ if (asym_active_balance(env))
+ return 1;
/*
* The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.
@@ -9150,7 +9153,7 @@ static int load_balance(int this_cpu, st
} else
sd->nr_balance_failed = 0;
- if (likely(!active_balance)) {
+ if (likely(!active_balance) || asym_active_balance(&env)) {
/* We were unbalanced, so reset the balancing interval */
sd->balance_interval = sd->min_interval;
} else {
next prev parent reply other threads:[~2018-12-13 13:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 15:56 [PATCH 0/3] sched/fair: some fixes for asym_packing Vincent Guittot
2018-08-07 15:56 ` [PATCH 1/3] sched/fair: fix rounding issue for asym packing Vincent Guittot
2018-08-07 15:56 ` [PATCH 2/3] sched/fair: trigger asym_packing during idle load balance Vincent Guittot
2018-08-07 15:56 ` [PATCH 3/3] sched/fair: fix unnecessary increase of balance interval Vincent Guittot
2018-12-13 13:52 ` Peter Zijlstra [this message]
2018-12-13 15:36 ` Vincent Guittot
2018-09-10 12:40 ` [PATCH 0/3] sched/fair: some fixes for asym_packing Vincent Guittot
-- strict thread matches above, loose matches on Subject: below --
2018-12-20 7:55 [PATCH v3 " Vincent Guittot
2018-12-20 7:55 ` [PATCH 3/3] sched/fair: fix unnecessary increase of balance interval Vincent Guittot
2018-12-20 11:22 ` Valentin Schneider
2018-12-20 14:50 ` Vincent Guittot
2018-12-20 17:24 ` Valentin Schneider
2018-12-21 14:49 ` Vincent Guittot
2018-12-21 17:15 ` Valentin Schneider
2018-12-21 17:41 ` 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=20181213135208.GI5289@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Morten.Rasmussen@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=valentin.schneider@arm.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