diff options
author | Li Zefan <lizefan@huawei.com> | 2013-03-29 02:38:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-04-10 07:54:19 -0400 |
commit | d1712796a880bea0a44739941116001923f3275b (patch) | |
tree | fe7aaf8dcf6569f05fc741c01bd7beb5633244f6 /kernel/sched/cpuacct.h | |
parent | 5f40d804325e925409907e29f46ecb012090b6c2 (diff) |
sched/cpuacct: Clean up cpuacct.h
Now most of the code in cpuacct.h can be moved to cpuacct.c
Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/515536D5.2080401@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/cpuacct.h')
-rw-r--r-- | kernel/sched/cpuacct.h | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/kernel/sched/cpuacct.h b/kernel/sched/cpuacct.h index b2f79ad1e524..51cd76eb4f0f 100644 --- a/kernel/sched/cpuacct.h +++ b/kernel/sched/cpuacct.h | |||
@@ -1,51 +1,5 @@ | |||
1 | /* Time spent by the tasks of the cpu accounting group executing in ... */ | ||
2 | enum cpuacct_stat_index { | ||
3 | CPUACCT_STAT_USER, /* ... user mode */ | ||
4 | CPUACCT_STAT_SYSTEM, /* ... kernel mode */ | ||
5 | |||
6 | CPUACCT_STAT_NSTATS, | ||
7 | }; | ||
8 | |||
9 | #ifdef CONFIG_CGROUP_CPUACCT | 1 | #ifdef CONFIG_CGROUP_CPUACCT |
10 | 2 | ||
11 | #include <linux/cgroup.h> | ||
12 | /* track cpu usage of a group of tasks and its child groups */ | ||
13 | struct cpuacct { | ||
14 | struct cgroup_subsys_state css; | ||
15 | /* cpuusage holds pointer to a u64-type object on every cpu */ | ||
16 | u64 __percpu *cpuusage; | ||
17 | struct kernel_cpustat __percpu *cpustat; | ||
18 | }; | ||
19 | |||
20 | extern struct cgroup_subsys cpuacct_subsys; | ||
21 | extern struct cpuacct root_cpuacct; | ||
22 | |||
23 | /* return cpu accounting group corresponding to this container */ | ||
24 | static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) | ||
25 | { | ||
26 | return container_of(cgroup_subsys_state(cgrp, cpuacct_subsys_id), | ||
27 | struct cpuacct, css); | ||
28 | } | ||
29 | |||
30 | /* return cpu accounting group to which this task belongs */ | ||
31 | static inline struct cpuacct *task_ca(struct task_struct *tsk) | ||
32 | { | ||
33 | return container_of(task_subsys_state(tsk, cpuacct_subsys_id), | ||
34 | struct cpuacct, css); | ||
35 | } | ||
36 | |||
37 | static inline struct cpuacct *__parent_ca(struct cpuacct *ca) | ||
38 | { | ||
39 | return cgroup_ca(ca->css.cgroup->parent); | ||
40 | } | ||
41 | |||
42 | static inline struct cpuacct *parent_ca(struct cpuacct *ca) | ||
43 | { | ||
44 | if (!ca->css.cgroup->parent) | ||
45 | return NULL; | ||
46 | return cgroup_ca(ca->css.cgroup->parent); | ||
47 | } | ||
48 | |||
49 | extern void cpuacct_init(void); | 3 | extern void cpuacct_init(void); |
50 | extern void cpuacct_charge(struct task_struct *tsk, u64 cputime); | 4 | extern void cpuacct_charge(struct task_struct *tsk, u64 cputime); |
51 | extern void cpuacct_account_field(struct task_struct *p, int index, u64 val); | 5 | extern void cpuacct_account_field(struct task_struct *p, int index, u64 val); |