diff options
-rw-r--r-- | include/linux/perf_counter.h | 5 | ||||
-rw-r--r-- | kernel/perf_counter.c | 5 | ||||
-rw-r--r-- | kernel/sched.c | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index f776851f8c4b..a356fa69796c 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -573,6 +573,8 @@ extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs); | |||
573 | 573 | ||
574 | extern int sysctl_perf_counter_priv; | 574 | extern int sysctl_perf_counter_priv; |
575 | 575 | ||
576 | extern void perf_counter_init(void); | ||
577 | |||
576 | #else | 578 | #else |
577 | static inline void | 579 | static inline void |
578 | perf_counter_task_sched_in(struct task_struct *task, int cpu) { } | 580 | perf_counter_task_sched_in(struct task_struct *task, int cpu) { } |
@@ -600,9 +602,10 @@ perf_counter_mmap(unsigned long addr, unsigned long len, | |||
600 | 602 | ||
601 | static inline void | 603 | static inline void |
602 | perf_counter_munmap(unsigned long addr, unsigned long len, | 604 | perf_counter_munmap(unsigned long addr, unsigned long len, |
603 | unsigned long pgoff, struct file *file) { } | 605 | unsigned long pgoff, struct file *file) { } |
604 | 606 | ||
605 | static inline void perf_counter_comm(struct task_struct *tsk) { } | 607 | static inline void perf_counter_comm(struct task_struct *tsk) { } |
608 | static inline void perf_counter_init(void) { } | ||
606 | #endif | 609 | #endif |
607 | 610 | ||
608 | #endif /* __KERNEL__ */ | 611 | #endif /* __KERNEL__ */ |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index b9679c36bcc2..fcdafa234a5d 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -3265,15 +3265,12 @@ static struct notifier_block __cpuinitdata perf_cpu_nb = { | |||
3265 | .notifier_call = perf_cpu_notify, | 3265 | .notifier_call = perf_cpu_notify, |
3266 | }; | 3266 | }; |
3267 | 3267 | ||
3268 | static int __init perf_counter_init(void) | 3268 | void __init perf_counter_init(void) |
3269 | { | 3269 | { |
3270 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, | 3270 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, |
3271 | (void *)(long)smp_processor_id()); | 3271 | (void *)(long)smp_processor_id()); |
3272 | register_cpu_notifier(&perf_cpu_nb); | 3272 | register_cpu_notifier(&perf_cpu_nb); |
3273 | |||
3274 | return 0; | ||
3275 | } | 3273 | } |
3276 | early_initcall(perf_counter_init); | ||
3277 | 3274 | ||
3278 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf) | 3275 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf) |
3279 | { | 3276 | { |
diff --git a/kernel/sched.c b/kernel/sched.c index 2f600e30dcf0..a728976a3a6c 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/completion.h> | 39 | #include <linux/completion.h> |
40 | #include <linux/kernel_stat.h> | 40 | #include <linux/kernel_stat.h> |
41 | #include <linux/debug_locks.h> | 41 | #include <linux/debug_locks.h> |
42 | #include <linux/perf_counter.h> | ||
42 | #include <linux/security.h> | 43 | #include <linux/security.h> |
43 | #include <linux/notifier.h> | 44 | #include <linux/notifier.h> |
44 | #include <linux/profile.h> | 45 | #include <linux/profile.h> |
@@ -8996,7 +8997,7 @@ void __init sched_init(void) | |||
8996 | * 1024) and two child groups A0 and A1 (of weight 1024 each), | 8997 | * 1024) and two child groups A0 and A1 (of weight 1024 each), |
8997 | * then A0's share of the cpu resource is: | 8998 | * then A0's share of the cpu resource is: |
8998 | * | 8999 | * |
8999 | * A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33% | 9000 | * A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33% |
9000 | * | 9001 | * |
9001 | * We achieve this by letting init_task_group's tasks sit | 9002 | * We achieve this by letting init_task_group's tasks sit |
9002 | * directly in rq->cfs (i.e init_task_group->se[] = NULL). | 9003 | * directly in rq->cfs (i.e init_task_group->se[] = NULL). |
@@ -9097,6 +9098,8 @@ void __init sched_init(void) | |||
9097 | alloc_bootmem_cpumask_var(&cpu_isolated_map); | 9098 | alloc_bootmem_cpumask_var(&cpu_isolated_map); |
9098 | #endif /* SMP */ | 9099 | #endif /* SMP */ |
9099 | 9100 | ||
9101 | perf_counter_init(); | ||
9102 | |||
9100 | scheduler_running = 1; | 9103 | scheduler_running = 1; |
9101 | } | 9104 | } |
9102 | 9105 | ||