From e272d4c2d0578b62a8d442ba9f08cbb28173ba46 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 23 Aug 2004 21:10:27 -0700 Subject: [PATCH] [PATCH] schedstat: UP fix SMP fix -- for_each_domain() is not defined if not CONFIG_SMP, so show_schedstat needed a couple of extra ifdefs. Signed-off-by: Rick Lindsley Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/sched-stats.txt | 8 ++++++-- kernel/sched.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/sched-stats.txt b/Documentation/sched-stats.txt index 6c0e84d1c5e0d..6f72021aae51f 100644 --- a/Documentation/sched-stats.txt +++ b/Documentation/sched-stats.txt @@ -1,6 +1,8 @@ Version 10 of schedstats includes support for sched_domains, which hit the mainline kernel in 2.6.7. Some counters make more sense to be -per-runqueue; other to be per-domain. +per-runqueue; other to be per-domain. Note that domains (and their associated +information) will only be pertinent and available on machines utilizing +CONFIG_SMP. In version 10 of schedstat, there is at least one level of domain statistics for each cpu listed, and there may well be more than one @@ -83,7 +85,9 @@ The last six are statistics dealing with pull_task(): Domain statistics ----------------- -One of these is produced per domain for each cpu described. +One of these is produced per domain for each cpu described. (Note that if +CONFIG_SMP is not defined, *no* domains are utilized and these lines +will not appear in the output.) domain 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 diff --git a/kernel/sched.c b/kernel/sched.c index d691dc5f2afc0..2c22759689ab6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -483,8 +483,10 @@ static int show_schedstat(struct seq_file *seq, void *v) seq_printf(seq, "timestamp %lu\n", jiffies); for_each_online_cpu(cpu) { runqueue_t *rq = cpu_rq(cpu); +#ifdef CONFIG_SMP struct sched_domain *sd; int dcnt = 0; +#endif /* runqueue-specific stats */ seq_printf(seq, @@ -506,6 +508,7 @@ static int show_schedstat(struct seq_file *seq, void *v) rq->pt_lost[itype]); seq_printf(seq, "\n"); +#ifdef CONFIG_SMP /* domain-specific stats */ for_each_domain(cpu, sd) { char mask_str[NR_CPUS]; @@ -524,6 +527,7 @@ static int show_schedstat(struct seq_file *seq, void *v) sd->sbe_pushed, sd->sbe_attempts, sd->ttwu_wake_affine, sd->ttwu_wake_balance); } +#endif } return 0; } -- 2.53.0