* [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() @ 2020-12-03 6:46 Yunfeng Ye 2020-12-03 6:47 ` [PATCH 2/2] sched: Split the function show_schedstat() Yunfeng Ye 2020-12-03 9:40 ` [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Mel Gorman 0 siblings, 2 replies; 7+ messages in thread From: Yunfeng Ye @ 2020-12-03 6:46 UTC (permalink / raw) To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman, bristot, linux-kernel Cc: Shiyuan Hu, Hewenliang A little clean up that moving the '\n' to the prior seq_printf. and remove the separate seq_printf which for line breaks. No functional changes. Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> --- kernel/sched/stats.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 750fb3c67eed..e99403df3f90 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -30,15 +30,13 @@ static int show_schedstat(struct seq_file *seq, void *v) /* runqueue-specific stats */ seq_printf(seq, - "cpu%d %u 0 %u %u %u %u %llu %llu %lu", + "cpu%d %u 0 %u %u %u %u %llu %llu %lu\n", cpu, rq->yld_count, rq->sched_count, rq->sched_goidle, rq->ttwu_count, rq->ttwu_local, rq->rq_cpu_time, rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount); - seq_printf(seq, "\n"); - #ifdef CONFIG_SMP /* domain-specific stats */ rcu_read_lock(); -- 2.18.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] sched: Split the function show_schedstat() 2020-12-03 6:46 [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Yunfeng Ye @ 2020-12-03 6:47 ` Yunfeng Ye 2020-12-03 9:42 ` Mel Gorman 2020-12-03 9:40 ` [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Mel Gorman 1 sibling, 1 reply; 7+ messages in thread From: Yunfeng Ye @ 2020-12-03 6:47 UTC (permalink / raw) To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman, bristot, linux-kernel Cc: Shiyuan Hu, Hewenliang The schedstat include runqueue-specific stats and domain-specific stats, so split it into two functions, show_rqstat() and show_domainstat(). No functional changes. Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> --- kernel/sched/stats.c | 101 +++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index e99403df3f90..ef75e7d64d32 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -12,61 +12,68 @@ */ #define SCHEDSTAT_VERSION 15 -static int show_schedstat(struct seq_file *seq, void *v) +static void show_domainstat(struct seq_file *seq, int cpu) +{ +#ifdef CONFIG_SMP + struct sched_domain *sd; + int dcount = 0; + + /* domain-specific stats */ + rcu_read_lock(); + for_each_domain(cpu, sd) { + enum cpu_idle_type itype; + + seq_printf(seq, "domain%d %*pb", dcount++, + cpumask_pr_args(sched_domain_span(sd))); + for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; + itype++) { + seq_printf(seq, " %u %u %u %u %u %u %u %u", + sd->lb_count[itype], + sd->lb_balanced[itype], + sd->lb_failed[itype], + sd->lb_imbalance[itype], + sd->lb_gained[itype], + sd->lb_hot_gained[itype], + sd->lb_nobusyq[itype], + sd->lb_nobusyg[itype]); + } + seq_printf(seq, + " %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); + } + rcu_read_unlock(); +#endif +} + +static void show_rqstat(struct seq_file *seq, int cpu) { - int cpu; + struct rq *rq = cpu_rq(cpu); + + /* runqueue-specific stats */ + seq_printf(seq, + "cpu%d %u 0 %u %u %u %u %llu %llu %lu\n", + cpu, rq->yld_count, + rq->sched_count, rq->sched_goidle, + rq->ttwu_count, rq->ttwu_local, + rq->rq_cpu_time, + rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount); +} +static int show_schedstat(struct seq_file *seq, void *v) +{ if (v == (void *)1) { seq_printf(seq, "version %d\n", SCHEDSTAT_VERSION); seq_printf(seq, "timestamp %lu\n", jiffies); } else { - struct rq *rq; -#ifdef CONFIG_SMP - struct sched_domain *sd; - int dcount = 0; -#endif - cpu = (unsigned long)(v - 2); - rq = cpu_rq(cpu); + int cpu = (unsigned long)(v - 2); - /* runqueue-specific stats */ - seq_printf(seq, - "cpu%d %u 0 %u %u %u %u %llu %llu %lu\n", - cpu, rq->yld_count, - rq->sched_count, rq->sched_goidle, - rq->ttwu_count, rq->ttwu_local, - rq->rq_cpu_time, - rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount); + show_rqstat(seq, cpu); + show_domainstat(seq, cpu); -#ifdef CONFIG_SMP - /* domain-specific stats */ - rcu_read_lock(); - for_each_domain(cpu, sd) { - enum cpu_idle_type itype; - - seq_printf(seq, "domain%d %*pb", dcount++, - cpumask_pr_args(sched_domain_span(sd))); - for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; - itype++) { - seq_printf(seq, " %u %u %u %u %u %u %u %u", - sd->lb_count[itype], - sd->lb_balanced[itype], - sd->lb_failed[itype], - sd->lb_imbalance[itype], - sd->lb_gained[itype], - sd->lb_hot_gained[itype], - sd->lb_nobusyq[itype], - sd->lb_nobusyg[itype]); - } - seq_printf(seq, - " %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); - } - rcu_read_unlock(); -#endif } return 0; } -- 2.18.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] sched: Split the function show_schedstat() 2020-12-03 6:47 ` [PATCH 2/2] sched: Split the function show_schedstat() Yunfeng Ye @ 2020-12-03 9:42 ` Mel Gorman 2020-12-04 1:22 ` Yunfeng Ye 0 siblings, 1 reply; 7+ messages in thread From: Mel Gorman @ 2020-12-03 9:42 UTC (permalink / raw) To: Yunfeng Ye Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, linux-kernel, Shiyuan Hu, Hewenliang On Thu, Dec 03, 2020 at 02:47:14PM +0800, Yunfeng Ye wrote: > The schedstat include runqueue-specific stats and domain-specific stats, > so split it into two functions, show_rqstat() and show_domainstat(). > > No functional changes. > > Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> Why? I could understand if there was a follow-up patch that adjusted some subset or there was a difference in checking for schedstat_enabled, locking or inserting new schedstat information. This can happen in the general case when the end result is easier to review here it seems to be just moving code around. -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] sched: Split the function show_schedstat() 2020-12-03 9:42 ` Mel Gorman @ 2020-12-04 1:22 ` Yunfeng Ye 2020-12-04 9:40 ` Mel Gorman 0 siblings, 1 reply; 7+ messages in thread From: Yunfeng Ye @ 2020-12-04 1:22 UTC (permalink / raw) To: Mel Gorman Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, linux-kernel, Shiyuan Hu, Hewenliang On 2020/12/3 17:42, Mel Gorman wrote: > On Thu, Dec 03, 2020 at 02:47:14PM +0800, Yunfeng Ye wrote: >> The schedstat include runqueue-specific stats and domain-specific stats, >> so split it into two functions, show_rqstat() and show_domainstat(). >> >> No functional changes. >> >> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> > > Why? > > I could understand if there was a follow-up patch that adjusted some > subset or there was a difference in checking for schedstat_enabled, > locking or inserting new schedstat information. This can happen in the > general case when the end result is easier to review here it seems to be > just moving code around. > The rqstat and domainstat is independent state information. so I think split it into two individual function is clearer. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] sched: Split the function show_schedstat() 2020-12-04 1:22 ` Yunfeng Ye @ 2020-12-04 9:40 ` Mel Gorman 2020-12-05 2:31 ` Yunfeng Ye 0 siblings, 1 reply; 7+ messages in thread From: Mel Gorman @ 2020-12-04 9:40 UTC (permalink / raw) To: Yunfeng Ye Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, linux-kernel, Shiyuan Hu, Hewenliang On Fri, Dec 04, 2020 at 09:22:34AM +0800, Yunfeng Ye wrote: > > > On 2020/12/3 17:42, Mel Gorman wrote: > > On Thu, Dec 03, 2020 at 02:47:14PM +0800, Yunfeng Ye wrote: > >> The schedstat include runqueue-specific stats and domain-specific stats, > >> so split it into two functions, show_rqstat() and show_domainstat(). > >> > >> No functional changes. > >> > >> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> > > > > Why? > > > > I could understand if there was a follow-up patch that adjusted some > > subset or there was a difference in checking for schedstat_enabled, > > locking or inserting new schedstat information. This can happen in the > > general case when the end result is easier to review here it seems to be > > just moving code around. > > > The rqstat and domainstat is independent state information. so I think > split it into two individual function is clearer. > The comments and the names of the structures being accessesd is sufficient to make it clear. -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] sched: Split the function show_schedstat() 2020-12-04 9:40 ` Mel Gorman @ 2020-12-05 2:31 ` Yunfeng Ye 0 siblings, 0 replies; 7+ messages in thread From: Yunfeng Ye @ 2020-12-05 2:31 UTC (permalink / raw) To: Mel Gorman Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, linux-kernel, Shiyuan Hu, Hewenliang On 2020/12/4 17:40, Mel Gorman wrote: > On Fri, Dec 04, 2020 at 09:22:34AM +0800, Yunfeng Ye wrote: >> >> >> On 2020/12/3 17:42, Mel Gorman wrote: >>> On Thu, Dec 03, 2020 at 02:47:14PM +0800, Yunfeng Ye wrote: >>>> The schedstat include runqueue-specific stats and domain-specific stats, >>>> so split it into two functions, show_rqstat() and show_domainstat(). >>>> >>>> No functional changes. >>>> >>>> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> >>> >>> Why? >>> >>> I could understand if there was a follow-up patch that adjusted some >>> subset or there was a difference in checking for schedstat_enabled, >>> locking or inserting new schedstat information. This can happen in the >>> general case when the end result is easier to review here it seems to be >>> just moving code around. >>> >> The rqstat and domainstat is independent state information. so I think >> split it into two individual function is clearer. >> > > The comments and the names of the structures being accessesd is sufficient > to make it clear. > ok, thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() 2020-12-03 6:46 [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Yunfeng Ye 2020-12-03 6:47 ` [PATCH 2/2] sched: Split the function show_schedstat() Yunfeng Ye @ 2020-12-03 9:40 ` Mel Gorman 1 sibling, 0 replies; 7+ messages in thread From: Mel Gorman @ 2020-12-03 9:40 UTC (permalink / raw) To: Yunfeng Ye Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, linux-kernel, Shiyuan Hu, Hewenliang On Thu, Dec 03, 2020 at 02:46:23PM +0800, Yunfeng Ye wrote: > A little clean up that moving the '\n' to the prior seq_printf. and > remove the separate seq_printf which for line breaks. > > No functional changes. > > Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com> Acked-by: Mel Gorman <mgorman@suse.de> -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-12-05 2:33 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-03 6:46 [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Yunfeng Ye 2020-12-03 6:47 ` [PATCH 2/2] sched: Split the function show_schedstat() Yunfeng Ye 2020-12-03 9:42 ` Mel Gorman 2020-12-04 1:22 ` Yunfeng Ye 2020-12-04 9:40 ` Mel Gorman 2020-12-05 2:31 ` Yunfeng Ye 2020-12-03 9:40 ` [PATCH 1/2] sched: Move '\n' to the prior seq_printf in show_schedstat() Mel Gorman
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).