Skip to content

Commit

Permalink
sched/cpuacct: Allocate per_cpu cpuusage for root cpuacct statically
Browse files Browse the repository at this point in the history
This is a preparation, so later we can initialize cpuacct
earlier.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/51553822.5000403@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Apr 10, 2013
1 parent d171279 commit 7943e15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/sched/cpuacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 7943e15

Please sign in to comment.