aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Chen <kenchen@google.com>2007-10-18 15:32:56 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-18 15:32:56 -0400
commit480b9434c542ddf2833aaed3dabba71bc0b787b5 (patch)
tree78c2638ac583cc57165ee1393ebbbbbe367f46fb
parentcc4ea79588e688ea9b1161650979a194dd709169 (diff)
sched: reduce schedstat variable overhead a bit
schedstat is useful in investigating CPU scheduler behavior. Ideally, I think it is beneficial to have it on all the time. However, the cost of turning it on in production system is quite high, largely due to number of events it collects and also due to its large memory footprint. Most of the fields probably don't need to be full 64-bit on 64-bit arch. Rolling over 4 billion events will most like take a long time and user space tool can be made to accommodate that. I'm proposing kernel to cut back most of variable width on 64-bit system. (note, the following patch doesn't affect 32-bit system). Signed-off-by: Ken Chen <kenchen@google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/sched.h42
-rw-r--r--kernel/sched.c20
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_stats.h8
4 files changed, 35 insertions, 37 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c204ab0d4df1..2f9c1261f202 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -569,7 +569,7 @@ struct sched_info {
569 last_queued; /* when we were last queued to run */ 569 last_queued; /* when we were last queued to run */
570#ifdef CONFIG_SCHEDSTATS 570#ifdef CONFIG_SCHEDSTATS
571 /* BKL stats */ 571 /* BKL stats */
572 unsigned long bkl_count; 572 unsigned int bkl_count;
573#endif 573#endif
574}; 574};
575#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 575#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
@@ -705,34 +705,34 @@ struct sched_domain {
705 705
706#ifdef CONFIG_SCHEDSTATS 706#ifdef CONFIG_SCHEDSTATS
707 /* load_balance() stats */ 707 /* load_balance() stats */
708 unsigned long lb_count[CPU_MAX_IDLE_TYPES]; 708 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
709 unsigned long lb_failed[CPU_MAX_IDLE_TYPES]; 709 unsigned int lb_failed[CPU_MAX_IDLE_TYPES];
710 unsigned long lb_balanced[CPU_MAX_IDLE_TYPES]; 710 unsigned int lb_balanced[CPU_MAX_IDLE_TYPES];
711 unsigned long lb_imbalance[CPU_MAX_IDLE_TYPES]; 711 unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES];
712 unsigned long lb_gained[CPU_MAX_IDLE_TYPES]; 712 unsigned int lb_gained[CPU_MAX_IDLE_TYPES];
713 unsigned long lb_hot_gained[CPU_MAX_IDLE_TYPES]; 713 unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES];
714 unsigned long lb_nobusyg[CPU_MAX_IDLE_TYPES]; 714 unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES];
715 unsigned long lb_nobusyq[CPU_MAX_IDLE_TYPES]; 715 unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES];
716 716
717 /* Active load balancing */ 717 /* Active load balancing */
718 unsigned long alb_count; 718 unsigned int alb_count;
719 unsigned long alb_failed; 719 unsigned int alb_failed;
720 unsigned long alb_pushed; 720 unsigned int alb_pushed;
721 721
722 /* SD_BALANCE_EXEC stats */ 722 /* SD_BALANCE_EXEC stats */
723 unsigned long sbe_count; 723 unsigned int sbe_count;
724 unsigned long sbe_balanced; 724 unsigned int sbe_balanced;
725 unsigned long sbe_pushed; 725 unsigned int sbe_pushed;
726 726
727 /* SD_BALANCE_FORK stats */ 727 /* SD_BALANCE_FORK stats */
728 unsigned long sbf_count; 728 unsigned int sbf_count;
729 unsigned long sbf_balanced; 729 unsigned int sbf_balanced;
730 unsigned long sbf_pushed; 730 unsigned int sbf_pushed;
731 731
732 /* try_to_wake_up() stats */ 732 /* try_to_wake_up() stats */
733 unsigned long ttwu_wake_remote; 733 unsigned int ttwu_wake_remote;
734 unsigned long ttwu_move_affine; 734 unsigned int ttwu_move_affine;
735 unsigned long ttwu_move_balance; 735 unsigned int ttwu_move_balance;
736#endif 736#endif
737}; 737};
738 738
diff --git a/kernel/sched.c b/kernel/sched.c
index b19cc5b79e26..b60f8a5ae2be 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -332,22 +332,22 @@ struct rq {
332 struct sched_info rq_sched_info; 332 struct sched_info rq_sched_info;
333 333
334 /* sys_sched_yield() stats */ 334 /* sys_sched_yield() stats */
335 unsigned long yld_exp_empty; 335 unsigned int yld_exp_empty;
336 unsigned long yld_act_empty; 336 unsigned int yld_act_empty;
337 unsigned long yld_both_empty; 337 unsigned int yld_both_empty;
338 unsigned long yld_count; 338 unsigned int yld_count;
339 339
340 /* schedule() stats */ 340 /* schedule() stats */
341 unsigned long sched_switch; 341 unsigned int sched_switch;
342 unsigned long sched_count; 342 unsigned int sched_count;
343 unsigned long sched_goidle; 343 unsigned int sched_goidle;
344 344
345 /* try_to_wake_up() stats */ 345 /* try_to_wake_up() stats */
346 unsigned long ttwu_count; 346 unsigned int ttwu_count;
347 unsigned long ttwu_local; 347 unsigned int ttwu_local;
348 348
349 /* BKL stats */ 349 /* BKL stats */
350 unsigned long bkl_count; 350 unsigned int bkl_count;
351#endif 351#endif
352 struct lock_class_key rq_lock_key; 352 struct lock_class_key rq_lock_key;
353}; 353};
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index a5e517ec07c3..e6fb392e5164 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -137,7 +137,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
137 SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running); 137 SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running);
138 SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight); 138 SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight);
139#ifdef CONFIG_SCHEDSTATS 139#ifdef CONFIG_SCHEDSTATS
140 SEQ_printf(m, " .%-30s: %ld\n", "bkl_count", 140 SEQ_printf(m, " .%-30s: %d\n", "bkl_count",
141 rq->bkl_count); 141 rq->bkl_count);
142#endif 142#endif
143 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over", 143 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over",
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 1c084842c3e7..ef1a7df80ea2 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
21 21
22 /* runqueue-specific stats */ 22 /* runqueue-specific stats */
23 seq_printf(seq, 23 seq_printf(seq,
24 "cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %llu %llu %lu", 24 "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu",
25 cpu, rq->yld_both_empty, 25 cpu, rq->yld_both_empty,
26 rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count, 26 rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
27 rq->sched_switch, rq->sched_count, rq->sched_goidle, 27 rq->sched_switch, rq->sched_count, rq->sched_goidle,
@@ -42,8 +42,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
42 seq_printf(seq, "domain%d %s", dcount++, mask_str); 42 seq_printf(seq, "domain%d %s", dcount++, mask_str);
43 for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; 43 for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
44 itype++) { 44 itype++) {
45 seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu " 45 seq_printf(seq, " %u %u %u %u %u %u %u %u",
46 "%lu",
47 sd->lb_count[itype], 46 sd->lb_count[itype],
48 sd->lb_balanced[itype], 47 sd->lb_balanced[itype],
49 sd->lb_failed[itype], 48 sd->lb_failed[itype],
@@ -53,8 +52,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
53 sd->lb_nobusyq[itype], 52 sd->lb_nobusyq[itype],
54 sd->lb_nobusyg[itype]); 53 sd->lb_nobusyg[itype]);
55 } 54 }
56 seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu %lu %lu" 55 seq_printf(seq, " %u %u %u %u %u %u %u %u %u %u %u %u\n",
57 " %lu %lu %lu\n",
58 sd->alb_count, sd->alb_failed, sd->alb_pushed, 56 sd->alb_count, sd->alb_failed, sd->alb_pushed,
59 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, 57 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
60 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, 58 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,