* [PATCH 1/5] cpuacct: Allocate per_cpu cpuusage for root cpuacct statically
2013-03-28 7:20 ` Li Zefan
@ 2013-03-28 7:20 ` Li Zefan
-1 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:20 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
This is a preparation, so later we can initialize cpuacct earlier.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
kernel/sched/cpuacct.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 9305fd2..a691c4d 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -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 = {
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 1/5] cpuacct: Allocate per_cpu cpuusage for root cpuacct statically
@ 2013-03-28 7:20 ` Li Zefan
0 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:20 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
This is a preparation, so later we can initialize cpuacct earlier.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
kernel/sched/cpuacct.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 9305fd2..a691c4d 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -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 = {
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] cpuacct: Initialize cpuacct subsystem earlier
2013-03-28 7:20 ` Li Zefan
@ 2013-03-28 7:21 ` Li Zefan
-1 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:21 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
Initialize cpuacct before the scheduler is functioning, so when
cpuacct_charge() and cpuacct_account_field() are called, task_ca()
won't return NULL.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
kernel/sched/cpuacct.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 0425581..75e46d2 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -292,9 +292,10 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
}
struct cgroup_subsys cpuacct_subsys = {
- .name = "cpuacct",
- .css_alloc = cpuacct_css_alloc,
- .css_free = cpuacct_css_free,
- .subsys_id = cpuacct_subsys_id,
- .base_cftypes = files,
+ .name = "cpuacct",
+ .css_alloc = cpuacct_css_alloc,
+ .css_free = cpuacct_css_free,
+ .subsys_id = cpuacct_subsys_id,
+ .base_cftypes = files,
+ .early_init = 1,
};
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 3/5] cpuacct: Initialize cpuacct subsystem earlier
@ 2013-03-28 7:21 ` Li Zefan
0 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:21 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
Initialize cpuacct before the scheduler is functioning, so when
cpuacct_charge() and cpuacct_account_field() are called, task_ca()
won't return NULL.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
kernel/sched/cpuacct.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 0425581..75e46d2 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -292,9 +292,10 @@ void cpuacct_account_field(struct task_struct *p, int index, u64 val)
}
struct cgroup_subsys cpuacct_subsys = {
- .name = "cpuacct",
- .css_alloc = cpuacct_css_alloc,
- .css_free = cpuacct_css_free,
- .subsys_id = cpuacct_subsys_id,
- .base_cftypes = files,
+ .name = "cpuacct",
+ .css_alloc = cpuacct_css_alloc,
+ .css_free = cpuacct_css_free,
+ .subsys_id = cpuacct_subsys_id,
+ .base_cftypes = files,
+ .early_init = 1,
};
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] cgroup: Remove subsys.active flag
2013-03-28 7:20 ` Li Zefan
@ 2013-03-28 7:21 ` Li Zefan
-1 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:21 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
The only user was cpuacct.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
include/linux/cgroup.h | 1 -
kernel/cgroup.c | 3 ---
2 files changed, 4 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7d73905..a236a5b 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -457,7 +457,6 @@ struct cgroup_subsys {
void (*bind)(struct cgroup *root);
int subsys_id;
- int active;
int disabled;
int early_init;
/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4855892..64dd57d 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4415,7 +4415,6 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
* need to invoke fork callbacks here. */
BUG_ON(!list_empty(&init_task.tasks));
- ss->active = 1;
BUG_ON(online_css(ss, dummytop));
mutex_unlock(&cgroup_mutex);
@@ -4523,7 +4522,6 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
}
write_unlock(&css_set_lock);
- ss->active = 1;
ret = online_css(ss, dummytop);
if (ret)
goto err_unload;
@@ -4565,7 +4563,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
mutex_lock(&cgroup_mutex);
offline_css(ss, dummytop);
- ss->active = 0;
if (ss->use_id) {
idr_remove_all(&ss->idr);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5/5] cgroup: Remove subsys.active flag
@ 2013-03-28 7:21 ` Li Zefan
0 siblings, 0 replies; 12+ messages in thread
From: Li Zefan @ 2013-03-28 7:21 UTC (permalink / raw)
To: Ingo Molnar, Tejun Heo; +Cc: Peter Zijlstra, LKML, Cgroups
The only user was cpuacct.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
include/linux/cgroup.h | 1 -
kernel/cgroup.c | 3 ---
2 files changed, 4 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7d73905..a236a5b 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -457,7 +457,6 @@ struct cgroup_subsys {
void (*bind)(struct cgroup *root);
int subsys_id;
- int active;
int disabled;
int early_init;
/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4855892..64dd57d 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4415,7 +4415,6 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
* need to invoke fork callbacks here. */
BUG_ON(!list_empty(&init_task.tasks));
- ss->active = 1;
BUG_ON(online_css(ss, dummytop));
mutex_unlock(&cgroup_mutex);
@@ -4523,7 +4522,6 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
}
write_unlock(&css_set_lock);
- ss->active = 1;
ret = online_css(ss, dummytop);
if (ret)
goto err_unload;
@@ -4565,7 +4563,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
mutex_lock(&cgroup_mutex);
offline_css(ss, dummytop);
- ss->active = 0;
if (ss->use_id) {
idr_remove_all(&ss->idr);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread[parent not found: <5153EF8D.2080502-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 5/5] cgroup: Remove subsys.active flag
2013-03-28 7:21 ` Li Zefan
@ 2013-03-28 18:19 ` Tejun Heo
-1 siblings, 0 replies; 12+ messages in thread
From: Tejun Heo @ 2013-03-28 18:19 UTC (permalink / raw)
To: Li Zefan; +Cc: Ingo Molnar, Peter Zijlstra, LKML, Cgroups
On Thu, Mar 28, 2013 at 03:21:49PM +0800, Li Zefan wrote:
> The only user was cpuacct.
>
> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Please feel free to route through -tip with the other cpuacct changes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 12+ messages in thread