Skip to content

Commit 7943e15

Browse files
lizf-osingomolnar
authored andcommitted
sched/cpuacct: Allocate per_cpu cpuusage for root cpuacct statically
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>
1 parent d171279 commit 7943e15

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/sched/cpuacct.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static inline struct cpuacct *parent_ca(struct cpuacct *ca)
5858
return cgroup_ca(ca->css.cgroup->parent);
5959
}
6060

61+
static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage);
6162
static struct cpuacct root_cpuacct;
6263

6364
/* create a new cpu accounting group */
@@ -290,8 +291,7 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
290291
void __init cpuacct_init(void)
291292
{
292293
root_cpuacct.cpustat = &kernel_cpustat;
293-
root_cpuacct.cpuusage = alloc_percpu(u64);
294-
BUG_ON(!root_cpuacct.cpuusage); /* Too early, not expected to fail */
294+
root_cpuacct.cpuusage = &root_cpuacct_cpuusage;
295295
}
296296

297297
struct cgroup_subsys cpuacct_subsys = {

0 commit comments

Comments
 (0)