提交 7943e15a 编写于 作者: L Li Zefan 提交者: Ingo Molnar

sched/cpuacct: Allocate per_cpu cpuusage for root cpuacct statically

This is a preparation, so later we can initialize cpuacct
earlier.
Signed-off-by: NLi Zefan <lizefan@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/51553822.5000403@huawei.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 d1712796
......@@ -58,6 +58,7 @@ static inline struct cpuacct *parent_ca(struct cpuacct *ca)
return cgroup_ca(ca->css.cgroup->parent);
}
static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage);
static struct cpuacct root_cpuacct;
/* create a new cpu accounting group */
......@@ -290,8 +291,7 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
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 */
root_cpuacct.cpuusage = &root_cpuacct_cpuusage;
}
struct cgroup_subsys cpuacct_subsys = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册