diff options
author | Li Zefan <lizefan@huawei.com> | 2013-03-29 10:36:55 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-04-10 15:54:16 +0400 |
commit | dbe4b41f9800223949ce72e4289814697e0ea91a (patch) | |
tree | 11f24c688852b29656724f0e7266f5b04d4291c6 /kernel/sched/cpuacct.c | |
parent | 60fed7891d4115be0ed7ff9ce6851eda80533c64 (diff) |
sched/cpuacct: Add cpuacct_init()
So we don't open-coded initialization of cpuacct in core.c.
Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/51553687.1060906@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/cpuacct.c')
-rw-r--r-- | kernel/sched/cpuacct.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 50ec24b6193d..48b5e9184dcc 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -218,6 +218,13 @@ void cpuacct_charge(struct task_struct *tsk, u64 cputime) rcu_read_unlock(); } +void __init cpuacct_init(void) +{ + root_cpuacct.cpustat = &kernel_cpustat; + root_cpuacct.cpuusage = alloc_percpu(u64); + BUG_ON(!root_cpuacct.cpuusage); /* Too early, not expected to fail */ +} + struct cgroup_subsys cpuacct_subsys = { .name = "cpuacct", .css_alloc = cpuacct_css_alloc, |