From: Abel Wu <wuyun.abel@bytedance.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 3/5] sched/fair: add stats for sched-idle balancing
Date: Thu, 17 Feb 2022 23:43:59 +0800 [thread overview]
Message-ID: <20220217154403.6497-4-wuyun.abel@bytedance.com> (raw)
In-Reply-To: <20220217154403.6497-1-wuyun.abel@bytedance.com>
To better understand the behavior of sched-idle balancing, add
some statistics like other load balancing mechanisms did.
Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
---
include/linux/sched/topology.h | 5 +++++
kernel/sched/fair.c | 6 +++++-
kernel/sched/stats.c | 5 +++--
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 03c9c81dc886..4259963d3e5e 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -150,6 +150,11 @@ struct sched_domain {
unsigned int ttwu_wake_remote;
unsigned int ttwu_move_affine;
unsigned int ttwu_move_balance;
+
+ /* sched-idle balancing */
+ unsigned int sib_peeked;
+ unsigned int sib_pulled;
+ unsigned int sib_failed;
#endif
#ifdef CONFIG_SCHED_DEBUG
char *name;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 070a6fb1d2bf..c83c0864e429 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10330,8 +10330,10 @@ static void sched_idle_balance(struct rq *dst_rq)
if (cpu == dst_cpu)
continue;
- if (!cfs_rq_overloaded(rq))
+ if (!cfs_rq_overloaded(rq)) {
+ schedstat_inc(sd->sib_peeked);
continue;
+ }
rq_lock_irqsave(rq, &rf);
@@ -10375,10 +10377,12 @@ static void sched_idle_balance(struct rq *dst_rq)
if (p) {
attach_one_task(dst_rq, p);
local_irq_restore(rf.flags);
+ schedstat_inc(sd->sib_pulled);
return;
}
local_irq_restore(rf.flags);
+ schedstat_inc(sd->sib_failed);
}
}
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index 07dde2928c79..3ee476c72806 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -164,12 +164,13 @@ static int show_schedstat(struct seq_file *seq, void *v)
sd->lb_nobusyg[itype]);
}
seq_printf(seq,
- " %u %u %u %u %u %u %u %u %u %u %u %u\n",
+ " %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n",
sd->alb_count, sd->alb_failed, sd->alb_pushed,
sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,
sd->ttwu_wake_remote, sd->ttwu_move_affine,
- sd->ttwu_move_balance);
+ sd->ttwu_move_balance, sd->sib_peeked,
+ sd->sib_pulled, sd->sib_failed);
}
rcu_read_unlock();
#endif
--
2.11.0
next prev parent reply other threads:[~2022-02-17 15:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 15:43 [RFC PATCH 0/5] introduce " Abel Wu
2022-02-17 15:43 ` [RFC PATCH 1/5] sched/fair: record overloaded cpus Abel Wu
2022-02-24 7:10 ` Gautham R. Shenoy
2022-02-24 14:36 ` Abel Wu
2022-02-27 8:08 ` Aubrey Li
2022-02-17 15:43 ` [RFC PATCH 2/5] sched/fair: introduce sched-idle balance Abel Wu
2022-02-17 15:43 ` Abel Wu [this message]
2022-02-17 15:44 ` [RFC PATCH 4/5] sched/fair: filter out overloaded cpus in sis Abel Wu
2022-02-17 15:44 ` [RFC PATCH 5/5] sched/fair: favor cpu capacity for idle tasks Abel Wu
2022-02-24 3:19 ` [RFC PATCH 0/5] introduce sched-idle balancing Abel Wu
2022-02-24 15:20 ` Peter Zijlstra
2022-02-24 15:29 ` Vincent Guittot
2022-02-25 6:51 ` Abel Wu
2022-02-25 6:46 ` Abel Wu
2022-02-25 8:29 ` Vincent Guittot
2022-02-25 10:46 ` Abel Wu
2022-02-25 13:15 ` Vincent Guittot
2022-02-24 16:47 ` Mel Gorman
2022-02-25 8:15 ` Abel Wu
2022-02-25 10:16 ` Mel Gorman
2022-02-25 13:20 ` Abel Wu
2022-03-02 0:41 ` Josh Don
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=20220217154403.6497-4-wuyun.abel@bytedance.com \
--to=wuyun.abel@bytedance.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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
all inboxes | Powered by JetHome®