LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, mgorman@suse.de,
juri.lelli@redhat.com, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, bristot@redhat.com, achaiken@aurora.tech
Cc: lkp@intel.com, linux-kernel@vger.kernel.org,
linux-rt-users@vger.kernel.org,
Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH v3 4/7] sched: make the output of schedstats independent of fair sched class
Date: Tue, 24 Aug 2021 11:29:43 +0000 [thread overview]
Message-ID: <20210824112946.9324-5-laoar.shao@gmail.com> (raw)
In-Reply-To: <20210824112946.9324-1-laoar.shao@gmail.com>
The per cpu stats can be show with /proc/sched_debug, which includes the
per cpu schedstats of each task group. Currently these per cpu
schedstats only show for the fair sched class. If we want to support
other sched classes, we have to make these output independent of fair
sched class.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Alison Chaiken <achaiken@aurora.tech>
---
kernel/sched/debug.c | 70 +++++++++++++++++++++++++++++++-------------
1 file changed, 50 insertions(+), 20 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 4cfee2aa1a2d..705987aed658 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -442,11 +442,7 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
struct sched_entity *se = tg->se[cpu];
#define P(F) SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F)
-#define P_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld\n", \
- "se->statistics."#F, (long long)schedstat_val(tg->stats[cpu]->F))
#define PN(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F))
-#define PN_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", \
- "se->statistics."#F, SPLIT_NS((long long)schedstat_val(tg->stats[cpu]->F)))
if (!se)
return;
@@ -454,20 +450,6 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
PN(se->exec_start);
PN(se->vruntime);
PN(se->sum_exec_runtime);
-
- if (schedstat_enabled()) {
- PN_SCHEDSTAT(wait_start);
- PN_SCHEDSTAT(sleep_start);
- PN_SCHEDSTAT(block_start);
- PN_SCHEDSTAT(sleep_max);
- PN_SCHEDSTAT(block_max);
- PN_SCHEDSTAT(exec_max);
- PN_SCHEDSTAT(slice_max);
- PN_SCHEDSTAT(wait_max);
- PN_SCHEDSTAT(wait_sum);
- P_SCHEDSTAT(wait_count);
- }
-
P(se->load.weight);
#ifdef CONFIG_SMP
P(se->avg.load_avg);
@@ -475,13 +457,60 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
P(se->avg.runnable_avg);
#endif
-#undef PN_SCHEDSTAT
#undef PN
-#undef P_SCHEDSTAT
#undef P
}
#endif
+#if defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)
+struct tg_schedstats {
+ struct seq_file *m;
+ int cpu;
+};
+
+static int tg_show_schedstats(struct task_group *tg, void *data)
+{
+ struct tg_schedstats *p = data;
+ struct seq_file *m = p->m;
+ int cpu = p->cpu;
+
+#define P_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld\n", \
+ "se->statistics."#F, (long long)schedstat_val(tg->stats[cpu]->F))
+#define PN_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", \
+ "se->statistics."#F, SPLIT_NS((long long)schedstat_val(tg->stats[cpu]->F)))
+
+ PN_SCHEDSTAT(wait_start);
+ PN_SCHEDSTAT(sleep_start);
+ PN_SCHEDSTAT(block_start);
+ PN_SCHEDSTAT(sleep_max);
+ PN_SCHEDSTAT(block_max);
+ PN_SCHEDSTAT(exec_max);
+ PN_SCHEDSTAT(slice_max);
+ PN_SCHEDSTAT(wait_max);
+ PN_SCHEDSTAT(wait_sum);
+ P_SCHEDSTAT(wait_count);
+
+#undef P_SCHEDSTAT
+#undef PN_SCHEDSTAT
+
+return 0;
+}
+
+static void print_task_group_stats(struct seq_file *m, int cpu)
+{
+ struct tg_schedstats data = {
+ .m = m,
+ .cpu = cpu,
+ };
+
+ if (!schedstat_enabled())
+ return;
+
+ walk_tg_tree(tg_show_schedstats, tg_nop, &data);
+}
+#endif
+
+
#ifdef CONFIG_CGROUP_SCHED
static DEFINE_SPINLOCK(sched_debug_lock);
static char group_path[PATH_MAX];
@@ -756,6 +785,7 @@ do { \
print_cfs_stats(m, cpu);
print_rt_stats(m, cpu);
print_dl_stats(m, cpu);
+ print_task_group_stats(m, cpu);
print_rq(m, rq, cpu);
SEQ_printf(m, "\n");
--
2.18.2
next prev parent reply other threads:[~2021-08-24 11:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 11:29 [PATCH v3 0/7] sched: support schedstats for RT " Yafang Shao
2021-08-24 11:29 ` [PATCH v3 1/7] sched, fair: use __schedstat_set() in set_next_entity() Yafang Shao
2021-08-24 11:29 ` [PATCH v3 2/7] sched: make struct sched_statistics independent of fair sched class Yafang Shao
2021-08-31 10:14 ` Peter Zijlstra
2021-08-31 13:25 ` Yafang Shao
2021-08-31 10:19 ` Peter Zijlstra
2021-08-31 13:25 ` Yafang Shao
2021-08-24 11:29 ` [PATCH v3 3/7] sched: make schedstats helpers " Yafang Shao
2021-08-31 11:07 ` Peter Zijlstra
2021-08-31 13:27 ` Yafang Shao
2021-08-24 11:29 ` Yafang Shao [this message]
2021-08-31 11:08 ` [PATCH v3 4/7] sched: make the output of schedstats " Peter Zijlstra
2021-08-31 13:27 ` Yafang Shao
2021-08-24 11:29 ` [PATCH v3 5/7] sched: introduce task block time in schedstats Yafang Shao
2021-08-24 11:29 ` [PATCH v3 6/7] sched, rt: support sched_stat_runtime tracepoint for RT sched class Yafang Shao
2021-08-24 11:29 ` [PATCH v3 7/7] sched, rt: support schedstats " Yafang Shao
2021-08-31 10:08 ` [PATCH v3 0/7] sched: " Peter Zijlstra
2021-08-31 10:44 ` Peter Zijlstra
2021-08-31 13:21 ` Yafang Shao
2021-08-31 12:57 ` Yafang Shao
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=20210824112946.9324-5-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=achaiken@aurora.tech \
--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=linux-rt-users@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--subject='Re: [PATCH v3 4/7] sched: make the output of schedstats independent of fair sched class' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).