提交 480b9434 编写于 作者: K Ken Chen 提交者: Ingo Molnar

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: NKen Chen <kenchen@google.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 cc4ea795
...@@ -569,7 +569,7 @@ struct sched_info { ...@@ -569,7 +569,7 @@ struct sched_info {
last_queued; /* when we were last queued to run */ last_queued; /* when we were last queued to run */
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHEDSTATS
/* BKL stats */ /* BKL stats */
unsigned long bkl_count; unsigned int bkl_count;
#endif #endif
}; };
#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
...@@ -705,34 +705,34 @@ struct sched_domain { ...@@ -705,34 +705,34 @@ struct sched_domain {
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHEDSTATS
/* load_balance() stats */ /* load_balance() stats */
unsigned long lb_count[CPU_MAX_IDLE_TYPES]; unsigned int lb_count[CPU_MAX_IDLE_TYPES];
unsigned long lb_failed[CPU_MAX_IDLE_TYPES]; unsigned int lb_failed[CPU_MAX_IDLE_TYPES];
unsigned long lb_balanced[CPU_MAX_IDLE_TYPES]; unsigned int lb_balanced[CPU_MAX_IDLE_TYPES];
unsigned long lb_imbalance[CPU_MAX_IDLE_TYPES]; unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES];
unsigned long lb_gained[CPU_MAX_IDLE_TYPES]; unsigned int lb_gained[CPU_MAX_IDLE_TYPES];
unsigned long lb_hot_gained[CPU_MAX_IDLE_TYPES]; unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES];
unsigned long lb_nobusyg[CPU_MAX_IDLE_TYPES]; unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES];
unsigned long lb_nobusyq[CPU_MAX_IDLE_TYPES]; unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES];
/* Active load balancing */ /* Active load balancing */
unsigned long alb_count; unsigned int alb_count;
unsigned long alb_failed; unsigned int alb_failed;
unsigned long alb_pushed; unsigned int alb_pushed;
/* SD_BALANCE_EXEC stats */ /* SD_BALANCE_EXEC stats */
unsigned long sbe_count; unsigned int sbe_count;
unsigned long sbe_balanced; unsigned int sbe_balanced;
unsigned long sbe_pushed; unsigned int sbe_pushed;
/* SD_BALANCE_FORK stats */ /* SD_BALANCE_FORK stats */
unsigned long sbf_count; unsigned int sbf_count;
unsigned long sbf_balanced; unsigned int sbf_balanced;
unsigned long sbf_pushed; unsigned int sbf_pushed;
/* try_to_wake_up() stats */ /* try_to_wake_up() stats */
unsigned long ttwu_wake_remote; unsigned int ttwu_wake_remote;
unsigned long ttwu_move_affine; unsigned int ttwu_move_affine;
unsigned long ttwu_move_balance; unsigned int ttwu_move_balance;
#endif #endif
}; };
......
...@@ -332,22 +332,22 @@ struct rq { ...@@ -332,22 +332,22 @@ struct rq {
struct sched_info rq_sched_info; struct sched_info rq_sched_info;
/* sys_sched_yield() stats */ /* sys_sched_yield() stats */
unsigned long yld_exp_empty; unsigned int yld_exp_empty;
unsigned long yld_act_empty; unsigned int yld_act_empty;
unsigned long yld_both_empty; unsigned int yld_both_empty;
unsigned long yld_count; unsigned int yld_count;
/* schedule() stats */ /* schedule() stats */
unsigned long sched_switch; unsigned int sched_switch;
unsigned long sched_count; unsigned int sched_count;
unsigned long sched_goidle; unsigned int sched_goidle;
/* try_to_wake_up() stats */ /* try_to_wake_up() stats */
unsigned long ttwu_count; unsigned int ttwu_count;
unsigned long ttwu_local; unsigned int ttwu_local;
/* BKL stats */ /* BKL stats */
unsigned long bkl_count; unsigned int bkl_count;
#endif #endif
struct lock_class_key rq_lock_key; struct lock_class_key rq_lock_key;
}; };
......
...@@ -137,7 +137,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) ...@@ -137,7 +137,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running); SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running);
SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight); SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight);
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHEDSTATS
SEQ_printf(m, " .%-30s: %ld\n", "bkl_count", SEQ_printf(m, " .%-30s: %d\n", "bkl_count",
rq->bkl_count); rq->bkl_count);
#endif #endif
SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over", SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over",
......
...@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v) ...@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
/* runqueue-specific stats */ /* runqueue-specific stats */
seq_printf(seq, seq_printf(seq,
"cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %llu %llu %lu", "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu",
cpu, rq->yld_both_empty, cpu, rq->yld_both_empty,
rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count, rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
rq->sched_switch, rq->sched_count, rq->sched_goidle, rq->sched_switch, rq->sched_count, rq->sched_goidle,
...@@ -42,8 +42,7 @@ static int show_schedstat(struct seq_file *seq, void *v) ...@@ -42,8 +42,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
seq_printf(seq, "domain%d %s", dcount++, mask_str); seq_printf(seq, "domain%d %s", dcount++, mask_str);
for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
itype++) { itype++) {
seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu " seq_printf(seq, " %u %u %u %u %u %u %u %u",
"%lu",
sd->lb_count[itype], sd->lb_count[itype],
sd->lb_balanced[itype], sd->lb_balanced[itype],
sd->lb_failed[itype], sd->lb_failed[itype],
...@@ -53,8 +52,7 @@ static int show_schedstat(struct seq_file *seq, void *v) ...@@ -53,8 +52,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
sd->lb_nobusyq[itype], sd->lb_nobusyq[itype],
sd->lb_nobusyg[itype]); sd->lb_nobusyg[itype]);
} }
seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu %lu %lu" seq_printf(seq, " %u %u %u %u %u %u %u %u %u %u %u %u\n",
" %lu %lu %lu\n",
sd->alb_count, sd->alb_failed, sd->alb_pushed, sd->alb_count, sd->alb_failed, sd->alb_pushed,
sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册