diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2016-06-17 13:43:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-05 07:29:47 -0400 |
commit | 4fa8d299b43a91f871f6d5b00dd5ab33d43bbc2c (patch) | |
tree | 86dcc557316f5bcd87f5c405b4ebb26a4086cafb /kernel/sched/debug.c | |
parent | 20e1d4863bfa7152e98f94e5bcdda3e7db41d899 (diff) |
sched/debug: Remove several CONFIG_SCHEDSTATS guards
Clean up the sched code by removing several of the CONFIG_SCHEDSTATS
guards, using schedstat_*() macros where needed.
Code size:
!CONFIG_SCHEDSTATS defconfig:
text data bss dec hex filename
10209818 4368184 1105920 15683922 ef5152 vmlinux.before.nostats
10209818 4368184 1105920 15683922 ef5152 vmlinux.after.nostats
CONFIG_SCHEDSTATS defconfig:
text data bss dec hex filename
10214210 4370040 1105920 15690170 ef69ba vmlinux.before.stats
10214210 4370680 1105920 15690810 ef6c3a vmlinux.after.stats
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/e51e0ebe5af95ac295de720dd252e7c0d2142e4a.1466184592.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/debug.c')
-rw-r--r-- | kernel/sched/debug.c | 99 |
1 files changed, 53 insertions, 46 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 63ffcaa5d57c..13935886a471 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -369,8 +369,12 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group | |||
369 | 369 | ||
370 | #define P(F) \ | 370 | #define P(F) \ |
371 | SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F) | 371 | SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F) |
372 | #define P_SCHEDSTAT(F) \ | ||
373 | SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)schedstat_val(F)) | ||
372 | #define PN(F) \ | 374 | #define PN(F) \ |
373 | SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F)) | 375 | SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F)) |
376 | #define PN_SCHEDSTAT(F) \ | ||
377 | SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)schedstat_val(F))) | ||
374 | 378 | ||
375 | if (!se) | 379 | if (!se) |
376 | return; | 380 | return; |
@@ -378,26 +382,27 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group | |||
378 | PN(se->exec_start); | 382 | PN(se->exec_start); |
379 | PN(se->vruntime); | 383 | PN(se->vruntime); |
380 | PN(se->sum_exec_runtime); | 384 | PN(se->sum_exec_runtime); |
381 | #ifdef CONFIG_SCHEDSTATS | ||
382 | if (schedstat_enabled()) { | 385 | if (schedstat_enabled()) { |
383 | PN(se->statistics.wait_start); | 386 | PN_SCHEDSTAT(se->statistics.wait_start); |
384 | PN(se->statistics.sleep_start); | 387 | PN_SCHEDSTAT(se->statistics.sleep_start); |
385 | PN(se->statistics.block_start); | 388 | PN_SCHEDSTAT(se->statistics.block_start); |
386 | PN(se->statistics.sleep_max); | 389 | PN_SCHEDSTAT(se->statistics.sleep_max); |
387 | PN(se->statistics.block_max); | 390 | PN_SCHEDSTAT(se->statistics.block_max); |
388 | PN(se->statistics.exec_max); | 391 | PN_SCHEDSTAT(se->statistics.exec_max); |
389 | PN(se->statistics.slice_max); | 392 | PN_SCHEDSTAT(se->statistics.slice_max); |
390 | PN(se->statistics.wait_max); | 393 | PN_SCHEDSTAT(se->statistics.wait_max); |
391 | PN(se->statistics.wait_sum); | 394 | PN_SCHEDSTAT(se->statistics.wait_sum); |
392 | P(se->statistics.wait_count); | 395 | P_SCHEDSTAT(se->statistics.wait_count); |
393 | } | 396 | } |
394 | #endif | ||
395 | P(se->load.weight); | 397 | P(se->load.weight); |
396 | #ifdef CONFIG_SMP | 398 | #ifdef CONFIG_SMP |
397 | P(se->avg.load_avg); | 399 | P(se->avg.load_avg); |
398 | P(se->avg.util_avg); | 400 | P(se->avg.util_avg); |
399 | #endif | 401 | #endif |
402 | |||
403 | #undef PN_SCHEDSTAT | ||
400 | #undef PN | 404 | #undef PN |
405 | #undef P_SCHEDSTAT | ||
401 | #undef P | 406 | #undef P |
402 | } | 407 | } |
403 | #endif | 408 | #endif |
@@ -626,9 +631,7 @@ do { \ | |||
626 | #undef P64 | 631 | #undef P64 |
627 | #endif | 632 | #endif |
628 | 633 | ||
629 | #ifdef CONFIG_SCHEDSTATS | 634 | #define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, schedstat_val(rq->n)); |
630 | #define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n); | ||
631 | |||
632 | if (schedstat_enabled()) { | 635 | if (schedstat_enabled()) { |
633 | P(yld_count); | 636 | P(yld_count); |
634 | P(sched_count); | 637 | P(sched_count); |
@@ -636,9 +639,8 @@ do { \ | |||
636 | P(ttwu_count); | 639 | P(ttwu_count); |
637 | P(ttwu_local); | 640 | P(ttwu_local); |
638 | } | 641 | } |
639 | |||
640 | #undef P | 642 | #undef P |
641 | #endif | 643 | |
642 | spin_lock_irqsave(&sched_debug_lock, flags); | 644 | spin_lock_irqsave(&sched_debug_lock, flags); |
643 | print_cfs_stats(m, cpu); | 645 | print_cfs_stats(m, cpu); |
644 | print_rt_stats(m, cpu); | 646 | print_rt_stats(m, cpu); |
@@ -868,10 +870,14 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
868 | SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)F) | 870 | SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)F) |
869 | #define P(F) \ | 871 | #define P(F) \ |
870 | SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)p->F) | 872 | SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)p->F) |
873 | #define P_SCHEDSTAT(F) \ | ||
874 | SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)schedstat_val(p->F)) | ||
871 | #define __PN(F) \ | 875 | #define __PN(F) \ |
872 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F)) | 876 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F)) |
873 | #define PN(F) \ | 877 | #define PN(F) \ |
874 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) | 878 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) |
879 | #define PN_SCHEDSTAT(F) \ | ||
880 | SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)schedstat_val(p->F))) | ||
875 | 881 | ||
876 | PN(se.exec_start); | 882 | PN(se.exec_start); |
877 | PN(se.vruntime); | 883 | PN(se.vruntime); |
@@ -881,37 +887,36 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
881 | 887 | ||
882 | P(se.nr_migrations); | 888 | P(se.nr_migrations); |
883 | 889 | ||
884 | #ifdef CONFIG_SCHEDSTATS | ||
885 | if (schedstat_enabled()) { | 890 | if (schedstat_enabled()) { |
886 | u64 avg_atom, avg_per_cpu; | 891 | u64 avg_atom, avg_per_cpu; |
887 | 892 | ||
888 | PN(se.statistics.sum_sleep_runtime); | 893 | PN_SCHEDSTAT(se.statistics.sum_sleep_runtime); |
889 | PN(se.statistics.wait_start); | 894 | PN_SCHEDSTAT(se.statistics.wait_start); |
890 | PN(se.statistics.sleep_start); | 895 | PN_SCHEDSTAT(se.statistics.sleep_start); |
891 | PN(se.statistics.block_start); | 896 | PN_SCHEDSTAT(se.statistics.block_start); |
892 | PN(se.statistics.sleep_max); | 897 | PN_SCHEDSTAT(se.statistics.sleep_max); |
893 | PN(se.statistics.block_max); | 898 | PN_SCHEDSTAT(se.statistics.block_max); |
894 | PN(se.statistics.exec_max); | 899 | PN_SCHEDSTAT(se.statistics.exec_max); |
895 | PN(se.statistics.slice_max); | 900 | PN_SCHEDSTAT(se.statistics.slice_max); |
896 | PN(se.statistics.wait_max); | 901 | PN_SCHEDSTAT(se.statistics.wait_max); |
897 | PN(se.statistics.wait_sum); | 902 | PN_SCHEDSTAT(se.statistics.wait_sum); |
898 | P(se.statistics.wait_count); | 903 | P_SCHEDSTAT(se.statistics.wait_count); |
899 | PN(se.statistics.iowait_sum); | 904 | PN_SCHEDSTAT(se.statistics.iowait_sum); |
900 | P(se.statistics.iowait_count); | 905 | P_SCHEDSTAT(se.statistics.iowait_count); |
901 | P(se.statistics.nr_migrations_cold); | 906 | P_SCHEDSTAT(se.statistics.nr_migrations_cold); |
902 | P(se.statistics.nr_failed_migrations_affine); | 907 | P_SCHEDSTAT(se.statistics.nr_failed_migrations_affine); |
903 | P(se.statistics.nr_failed_migrations_running); | 908 | P_SCHEDSTAT(se.statistics.nr_failed_migrations_running); |
904 | P(se.statistics.nr_failed_migrations_hot); | 909 | P_SCHEDSTAT(se.statistics.nr_failed_migrations_hot); |
905 | P(se.statistics.nr_forced_migrations); | 910 | P_SCHEDSTAT(se.statistics.nr_forced_migrations); |
906 | P(se.statistics.nr_wakeups); | 911 | P_SCHEDSTAT(se.statistics.nr_wakeups); |
907 | P(se.statistics.nr_wakeups_sync); | 912 | P_SCHEDSTAT(se.statistics.nr_wakeups_sync); |
908 | P(se.statistics.nr_wakeups_migrate); | 913 | P_SCHEDSTAT(se.statistics.nr_wakeups_migrate); |
909 | P(se.statistics.nr_wakeups_local); | 914 | P_SCHEDSTAT(se.statistics.nr_wakeups_local); |
910 | P(se.statistics.nr_wakeups_remote); | 915 | P_SCHEDSTAT(se.statistics.nr_wakeups_remote); |
911 | P(se.statistics.nr_wakeups_affine); | 916 | P_SCHEDSTAT(se.statistics.nr_wakeups_affine); |
912 | P(se.statistics.nr_wakeups_affine_attempts); | 917 | P_SCHEDSTAT(se.statistics.nr_wakeups_affine_attempts); |
913 | P(se.statistics.nr_wakeups_passive); | 918 | P_SCHEDSTAT(se.statistics.nr_wakeups_passive); |
914 | P(se.statistics.nr_wakeups_idle); | 919 | P_SCHEDSTAT(se.statistics.nr_wakeups_idle); |
915 | 920 | ||
916 | avg_atom = p->se.sum_exec_runtime; | 921 | avg_atom = p->se.sum_exec_runtime; |
917 | if (nr_switches) | 922 | if (nr_switches) |
@@ -930,7 +935,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
930 | __PN(avg_atom); | 935 | __PN(avg_atom); |
931 | __PN(avg_per_cpu); | 936 | __PN(avg_per_cpu); |
932 | } | 937 | } |
933 | #endif | 938 | |
934 | __P(nr_switches); | 939 | __P(nr_switches); |
935 | SEQ_printf(m, "%-45s:%21Ld\n", | 940 | SEQ_printf(m, "%-45s:%21Ld\n", |
936 | "nr_voluntary_switches", (long long)p->nvcsw); | 941 | "nr_voluntary_switches", (long long)p->nvcsw); |
@@ -947,8 +952,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
947 | #endif | 952 | #endif |
948 | P(policy); | 953 | P(policy); |
949 | P(prio); | 954 | P(prio); |
955 | #undef PN_SCHEDSTAT | ||
950 | #undef PN | 956 | #undef PN |
951 | #undef __PN | 957 | #undef __PN |
958 | #undef P_SCHEDSTAT | ||
952 | #undef P | 959 | #undef P |
953 | #undef __P | 960 | #undef __P |
954 | 961 | ||