* [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 8:20 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:20 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
This will be used as a replacement for css_lookup().
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
include/linux/cgroup.h | 1 +
kernel/cgroup.c | 31 +++++++++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 96072e4..6ae8ae1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
#else /* !CONFIG_CGROUPS */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e87872c..5ae1e87 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -139,7 +139,7 @@ struct cgroupfs_root {
unsigned long flags;
/* IDs for cgroups in this hierarchy */
- struct ida cgroup_ida;
+ struct idr cgroup_idr;
/* The path to use for release notifications. */
char release_agent_path[PATH_MAX];
@@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
simple_xattrs_free(&cgrp->xattrs);
- ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
+ idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
kfree(rcu_dereference_raw(cgrp->name));
kfree(cgrp);
}
@@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
root->subsys_mask = opts->subsys_mask;
root->flags = opts->flags;
- ida_init(&root->cgroup_ida);
+ idr_init(&root->cgroup_idr);
+
if (opts->release_agent)
strcpy(root->release_agent_path, opts->release_agent);
if (opts->name)
@@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
spin_lock(&hierarchy_id_lock);
ida_remove(&hierarchy_ida, root->hierarchy_id);
spin_unlock(&hierarchy_id_lock);
- ida_destroy(&root->cgroup_ida);
+ idr_destroy(&root->cgroup_idr);
kfree(root);
}
@@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
mutex_lock(&cgroup_mutex);
mutex_lock(&cgroup_root_mutex);
+ root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
+ 0, 0, GFP_KERNEL);
+ if (root_cgrp->id < 0)
+ goto unlock_drop;
+
/* Check for name clashes with existing mounts */
ret = -EBUSY;
if (strlen(root->name))
@@ -4104,7 +4110,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_cgrp;
rcu_assign_pointer(cgrp->name, name);
- cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
+ cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
if (cgrp->id < 0)
goto err_free_name;
@@ -4215,7 +4221,7 @@ err_free_all:
/* Release the reference count that we took on the superblock */
deactivate_super(sb);
err_free_id:
- ida_simple_remove(&root->cgroup_ida, cgrp->id);
+ idr_remove(&root->cgroup_idr, cgrp->id);
err_free_name:
kfree(rcu_dereference_raw(cgrp->name));
err_free_cgrp:
@@ -5320,6 +5326,19 @@ bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root)
return (child == root);
}
+/**
+ * cgroup_from_id - lookup cgroup by id
+ * @ss: cgroup subsys to be looked into.
+ * @id: the id
+ *
+ * Returns pointer to cgroup if there is valid one with id.
+ * NULL if not. Should be called under rcu_read_lock()
+ */
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
+{
+ return idr_find(&ss->root->cgroup_idr, id);
+}
+
#ifdef CONFIG_CGROUP_DEBUG
static struct cgroup_subsys_state *debug_css_alloc(struct cgroup *cont)
{
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-08 8:20 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:20 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This will be used as a replacement for css_lookup().
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
include/linux/cgroup.h | 1 +
kernel/cgroup.c | 31 +++++++++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 96072e4..6ae8ae1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
#else /* !CONFIG_CGROUPS */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e87872c..5ae1e87 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -139,7 +139,7 @@ struct cgroupfs_root {
unsigned long flags;
/* IDs for cgroups in this hierarchy */
- struct ida cgroup_ida;
+ struct idr cgroup_idr;
/* The path to use for release notifications. */
char release_agent_path[PATH_MAX];
@@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
simple_xattrs_free(&cgrp->xattrs);
- ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
+ idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
kfree(rcu_dereference_raw(cgrp->name));
kfree(cgrp);
}
@@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
root->subsys_mask = opts->subsys_mask;
root->flags = opts->flags;
- ida_init(&root->cgroup_ida);
+ idr_init(&root->cgroup_idr);
+
if (opts->release_agent)
strcpy(root->release_agent_path, opts->release_agent);
if (opts->name)
@@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
spin_lock(&hierarchy_id_lock);
ida_remove(&hierarchy_ida, root->hierarchy_id);
spin_unlock(&hierarchy_id_lock);
- ida_destroy(&root->cgroup_ida);
+ idr_destroy(&root->cgroup_idr);
kfree(root);
}
@@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
mutex_lock(&cgroup_mutex);
mutex_lock(&cgroup_root_mutex);
+ root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
+ 0, 0, GFP_KERNEL);
+ if (root_cgrp->id < 0)
+ goto unlock_drop;
+
/* Check for name clashes with existing mounts */
ret = -EBUSY;
if (strlen(root->name))
@@ -4104,7 +4110,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_cgrp;
rcu_assign_pointer(cgrp->name, name);
- cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
+ cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
if (cgrp->id < 0)
goto err_free_name;
@@ -4215,7 +4221,7 @@ err_free_all:
/* Release the reference count that we took on the superblock */
deactivate_super(sb);
err_free_id:
- ida_simple_remove(&root->cgroup_ida, cgrp->id);
+ idr_remove(&root->cgroup_idr, cgrp->id);
err_free_name:
kfree(rcu_dereference_raw(cgrp->name));
err_free_cgrp:
@@ -5320,6 +5326,19 @@ bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root)
return (child == root);
}
+/**
+ * cgroup_from_id - lookup cgroup by id
+ * @ss: cgroup subsys to be looked into.
+ * @id: the id
+ *
+ * Returns pointer to cgroup if there is valid one with id.
+ * NULL if not. Should be called under rcu_read_lock()
+ */
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
+{
+ return idr_find(&ss->root->cgroup_idr, id);
+}
+
#ifdef CONFIG_CGROUP_DEBUG
static struct cgroup_subsys_state *debug_css_alloc(struct cgroup *cont)
{
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-08 8:20 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:20 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This will be used as a replacement for css_lookup().
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
include/linux/cgroup.h | 1 +
kernel/cgroup.c | 31 +++++++++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 96072e4..6ae8ae1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
#else /* !CONFIG_CGROUPS */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e87872c..5ae1e87 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -139,7 +139,7 @@ struct cgroupfs_root {
unsigned long flags;
/* IDs for cgroups in this hierarchy */
- struct ida cgroup_ida;
+ struct idr cgroup_idr;
/* The path to use for release notifications. */
char release_agent_path[PATH_MAX];
@@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
simple_xattrs_free(&cgrp->xattrs);
- ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
+ idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
kfree(rcu_dereference_raw(cgrp->name));
kfree(cgrp);
}
@@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
root->subsys_mask = opts->subsys_mask;
root->flags = opts->flags;
- ida_init(&root->cgroup_ida);
+ idr_init(&root->cgroup_idr);
+
if (opts->release_agent)
strcpy(root->release_agent_path, opts->release_agent);
if (opts->name)
@@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
spin_lock(&hierarchy_id_lock);
ida_remove(&hierarchy_ida, root->hierarchy_id);
spin_unlock(&hierarchy_id_lock);
- ida_destroy(&root->cgroup_ida);
+ idr_destroy(&root->cgroup_idr);
kfree(root);
}
@@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
mutex_lock(&cgroup_mutex);
mutex_lock(&cgroup_root_mutex);
+ root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
+ 0, 0, GFP_KERNEL);
+ if (root_cgrp->id < 0)
+ goto unlock_drop;
+
/* Check for name clashes with existing mounts */
ret = -EBUSY;
if (strlen(root->name))
@@ -4104,7 +4110,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_cgrp;
rcu_assign_pointer(cgrp->name, name);
- cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
+ cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
if (cgrp->id < 0)
goto err_free_name;
@@ -4215,7 +4221,7 @@ err_free_all:
/* Release the reference count that we took on the superblock */
deactivate_super(sb);
err_free_id:
- ida_simple_remove(&root->cgroup_ida, cgrp->id);
+ idr_remove(&root->cgroup_idr, cgrp->id);
err_free_name:
kfree(rcu_dereference_raw(cgrp->name));
err_free_cgrp:
@@ -5320,6 +5326,19 @@ bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root)
return (child == root);
}
+/**
+ * cgroup_from_id - lookup cgroup by id
+ * @ss: cgroup subsys to be looked into.
+ * @id: the id
+ *
+ * Returns pointer to cgroup if there is valid one with id.
+ * NULL if not. Should be called under rcu_read_lock()
+ */
+struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
+{
+ return idr_find(&ss->root->cgroup_idr, id);
+}
+
#ifdef CONFIG_CGROUP_DEBUG
static struct cgroup_subsys_state *debug_css_alloc(struct cgroup *cont)
{
--
1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 8:20 ` Li Zefan
@ 2013-04-08 15:43 ` Tejun Heo
-1 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:43 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
> +/**
> + * cgroup_from_id - lookup cgroup by id
> + * @ss: cgroup subsys to be looked into.
> + * @id: the id
> + *
> + * Returns pointer to cgroup if there is valid one with id.
> + * NULL if not. Should be called under rcu_read_lock()
> + */
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
> +{
rcu_lockdep_assert(rcu_read_lock_held(), ...);
> + return idr_find(&ss->root->cgroup_idr, id);
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-08 15:43 ` Tejun Heo
0 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:43 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
> +/**
> + * cgroup_from_id - lookup cgroup by id
> + * @ss: cgroup subsys to be looked into.
> + * @id: the id
> + *
> + * Returns pointer to cgroup if there is valid one with id.
> + * NULL if not. Should be called under rcu_read_lock()
> + */
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
> +{
rcu_lockdep_assert(rcu_read_lock_held(), ...);
> + return idr_find(&ss->root->cgroup_idr, id);
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread[parent not found: <20130408154319.GD3021-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>]
* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 15:43 ` Tejun Heo
(?)
@ 2013-04-09 3:12 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:12 UTC (permalink / raw)
To: Tejun Heo
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
On 2013/4/8 23:43, Tejun Heo wrote:
> On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
>> +/**
>> + * cgroup_from_id - lookup cgroup by id
>> + * @ss: cgroup subsys to be looked into.
>> + * @id: the id
>> + *
>> + * Returns pointer to cgroup if there is valid one with id.
>> + * NULL if not. Should be called under rcu_read_lock()
>> + */
>> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
>> +{
>
> rcu_lockdep_assert(rcu_read_lock_held(), ..
.);
will update
>
>> + return idr_find(&ss->root->cgroup_idr, id);
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-09 3:12 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:12 UTC (permalink / raw)
To: Tejun Heo
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 23:43, Tejun Heo wrote:
> On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
>> +/**
>> + * cgroup_from_id - lookup cgroup by id
>> + * @ss: cgroup subsys to be looked into.
>> + * @id: the id
>> + *
>> + * Returns pointer to cgroup if there is valid one with id.
>> + * NULL if not. Should be called under rcu_read_lock()
>> + */
>> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
>> +{
>
> rcu_lockdep_assert(rcu_read_lock_held(), ..
.);
will update
>
>> + return idr_find(&ss->root->cgroup_idr, id);
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-09 3:12 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:12 UTC (permalink / raw)
To: Tejun Heo
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 23:43, Tejun Heo wrote:
> On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
>> +/**
>> + * cgroup_from_id - lookup cgroup by id
>> + * @ss: cgroup subsys to be looked into.
>> + * @id: the id
>> + *
>> + * Returns pointer to cgroup if there is valid one with id.
>> + * NULL if not. Should be called under rcu_read_lock()
>> + */
>> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
>> +{
>
> rcu_lockdep_assert(rcu_read_lock_held(), ..
.);
will update
>
>> + return idr_find(&ss->root->cgroup_idr, id);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 8:20 ` Li Zefan
@ 2013-04-08 15:48 ` Tejun Heo
-1 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:48 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
Oops, one more thing.
On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
> - cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
> + cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
This will allow lookups to return half-initialized cgroup, which
shouldn't happen. Either idr_alloc() should be moved to after
initialization of other fields are finished, or it should be called
with NULL @ptr with idr_replace() added at the end to install @cgrp.
Similarly, the removal path should guarantee that the object is
removed from idr *before* its grace period starts.
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-08 15:48 ` Tejun Heo
0 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:48 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
Oops, one more thing.
On Mon, Apr 08, 2013 at 04:20:59PM +0800, Li Zefan wrote:
> - cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
> + cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
This will allow lookups to return half-initialized cgroup, which
shouldn't happen. Either idr_alloc() should be moved to after
initialization of other fields are finished, or it should be called
with NULL @ptr with idr_replace() added at the end to install @cgrp.
Similarly, the removal path should guarantee that the object is
removed from idr *before* its grace period starts.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 8:20 ` Li Zefan
@ 2013-04-09 3:56 ` Kamezawa Hiroyuki
-1 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 3:56 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:20), Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 31 +++++++++++++++++++++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 96072e4..6ae8ae1 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
> struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
>
> bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
>
> #else /* !CONFIG_CGROUPS */
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index e87872c..5ae1e87 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -139,7 +139,7 @@ struct cgroupfs_root {
> unsigned long flags;
>
> /* IDs for cgroups in this hierarchy */
> - struct ida cgroup_ida;
> + struct idr cgroup_idr;
>
> /* The path to use for release notifications. */
> char release_agent_path[PATH_MAX];
> @@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
>
> simple_xattrs_free(&cgrp->xattrs);
>
> - ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
> + idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
> kfree(rcu_dereference_raw(cgrp->name));
> kfree(cgrp);
> }
> @@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>
> root->subsys_mask = opts->subsys_mask;
> root->flags = opts->flags;
> - ida_init(&root->cgroup_ida);
> + idr_init(&root->cgroup_idr);
> +
> if (opts->release_agent)
> strcpy(root->release_agent_path, opts->release_agent);
> if (opts->name)
> @@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
> spin_lock(&hierarchy_id_lock);
> ida_remove(&hierarchy_ida, root->hierarchy_id);
> spin_unlock(&hierarchy_id_lock);
> - ida_destroy(&root->cgroup_ida);
> + idr_destroy(&root->cgroup_idr);
> kfree(root);
> }
>
> @@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
> mutex_lock(&cgroup_mutex);
> mutex_lock(&cgroup_root_mutex);
>
> + root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
> + 0, 0, GFP_KERNEL);
> + if (root_cgrp->id < 0)
> + goto unlock_drop;
> +
> /* Check for name clashes with existing mounts */
> ret = -EBUSY;
> if (strlen(root->name))
> @@ -4104,7 +4110,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
> goto err_free_cgrp;
> rcu_assign_pointer(cgrp->name, name);
>
> - cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
> + cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
> if (cgrp->id < 0)
> goto err_free_name;
>
> @@ -4215,7 +4221,7 @@ err_free_all:
> /* Release the reference count that we took on the superblock */
> deactivate_super(sb);
> err_free_id:
> - ida_simple_remove(&root->cgroup_ida, cgrp->id);
> + idr_remove(&root->cgroup_idr, cgrp->id);
> err_free_name:
> kfree(rcu_dereference_raw(cgrp->name));
> err_free_cgrp:
> @@ -5320,6 +5326,19 @@ bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root)
> return (child == root);
> }
>
> +/**
> + * cgroup_from_id - lookup cgroup by id
> + * @ss: cgroup subsys to be looked into.
> + * @id: the id
> + *
> + * Returns pointer to cgroup if there is valid one with id.
> + * NULL if not. Should be called under rcu_read_lock()
> + */
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
> +{
> + return idr_find(&ss->root->cgroup_idr, id);
> +}
> +
How about checking cgroup_populated_dir() have been called once ?
If not, returning NULL.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-09 3:56 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 3:56 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:20), Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 31 +++++++++++++++++++++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 96072e4..6ae8ae1 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
> struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
>
> bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
>
> #else /* !CONFIG_CGROUPS */
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index e87872c..5ae1e87 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -139,7 +139,7 @@ struct cgroupfs_root {
> unsigned long flags;
>
> /* IDs for cgroups in this hierarchy */
> - struct ida cgroup_ida;
> + struct idr cgroup_idr;
>
> /* The path to use for release notifications. */
> char release_agent_path[PATH_MAX];
> @@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
>
> simple_xattrs_free(&cgrp->xattrs);
>
> - ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
> + idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
> kfree(rcu_dereference_raw(cgrp->name));
> kfree(cgrp);
> }
> @@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>
> root->subsys_mask = opts->subsys_mask;
> root->flags = opts->flags;
> - ida_init(&root->cgroup_ida);
> + idr_init(&root->cgroup_idr);
> +
> if (opts->release_agent)
> strcpy(root->release_agent_path, opts->release_agent);
> if (opts->name)
> @@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
> spin_lock(&hierarchy_id_lock);
> ida_remove(&hierarchy_ida, root->hierarchy_id);
> spin_unlock(&hierarchy_id_lock);
> - ida_destroy(&root->cgroup_ida);
> + idr_destroy(&root->cgroup_idr);
> kfree(root);
> }
>
> @@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
> mutex_lock(&cgroup_mutex);
> mutex_lock(&cgroup_root_mutex);
>
> + root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
> + 0, 0, GFP_KERNEL);
> + if (root_cgrp->id < 0)
> + goto unlock_drop;
> +
> /* Check for name clashes with existing mounts */
> ret = -EBUSY;
> if (strlen(root->name))
> @@ -4104,7 +4110,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
> goto err_free_cgrp;
> rcu_assign_pointer(cgrp->name, name);
>
> - cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
> + cgrp->id = idr_alloc(&root->cgroup_idr, cgrp, 1, 0, GFP_KERNEL);
> if (cgrp->id < 0)
> goto err_free_name;
>
> @@ -4215,7 +4221,7 @@ err_free_all:
> /* Release the reference count that we took on the superblock */
> deactivate_super(sb);
> err_free_id:
> - ida_simple_remove(&root->cgroup_ida, cgrp->id);
> + idr_remove(&root->cgroup_idr, cgrp->id);
> err_free_name:
> kfree(rcu_dereference_raw(cgrp->name));
> err_free_cgrp:
> @@ -5320,6 +5326,19 @@ bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root)
> return (child == root);
> }
>
> +/**
> + * cgroup_from_id - lookup cgroup by id
> + * @ss: cgroup subsys to be looked into.
> + * @id: the id
> + *
> + * Returns pointer to cgroup if there is valid one with id.
> + * NULL if not. Should be called under rcu_read_lock()
> + */
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
> +{
> + return idr_find(&ss->root->cgroup_idr, id);
> +}
> +
How about checking cgroup_populated_dir() have been called once ?
If not, returning NULL.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 98+ messages in thread
[parent not found: <51627DEB.4090104-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
2013-04-08 8:20 ` Li Zefan
(?)
@ 2013-04-09 4:08 ` Kamezawa Hiroyuki
-1 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:08 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
(2013/04/08 17:20), Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 31 +++++++++++++++++++++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 96072e4..6ae8ae1 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
> struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
>
> bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
>
> #else /* !CONFIG_CGROUPS */
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index e87872c..5ae1e87 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -139,7 +139,7 @@ struct cgroupfs_root {
> unsigned long flags;
>
> /* IDs for cgroups in this hierarchy */
> - struct ida cgroup_ida;
> + struct idr cgroup_idr;
>
> /* The path to use for release notifications. */
> char release_agent_path[PATH_MAX];
> @@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
>
> simple_xattrs_free(&cgrp->xattrs);
>
> - ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
> + idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
> kfree(rcu_dereference_raw(cgrp->name));
> kfree(cgrp);
> }
> @@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>
> root->subsys_mask = opts->subsys_mask;
> root->flags = opts->flags;
> - ida_init(&root->cgroup_ida);
> + idr_init(&root->cgroup_idr);
> +
> if (opts->release_agent)
> strcpy(root->release_agent_path, opts->release_agent);
> if (opts->name)
> @@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
> spin_lock(&hierarchy_id_lock);
> ida_remove(&hierarchy_ida, root->hierarchy_id);
> spin_unlock(&hierarchy_id_lock);
> - ida_destroy(&root->cgroup_ida);
> + idr_destroy(&root->cgroup_idr);
> kfree(root);
> }
>
> @@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
> mutex_lock(&cgroup_mutex);
> mutex_lock(&cgroup_root_mutex);
>
> + root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
> + 0, 0, GFP_KERNEL);
> + if (root_cgrp->id < 0)
> + goto unlock_drop;
Ah. hmm, I'm sorry but css ID is allocated from "1" and 0 was an invalid number.
With this change, root cgroup will have 0.
If this change is intentional, please add comments in Changelog.
IIRC, swap_cgroup treats 0 as "unused" (root_memcg doesn't account anything...
so, I guess we'll not see troubles.) we need double check.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-09 4:08 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:08 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:20), Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 31 +++++++++++++++++++++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 96072e4..6ae8ae1 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
> struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
>
> bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
>
> #else /* !CONFIG_CGROUPS */
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index e87872c..5ae1e87 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -139,7 +139,7 @@ struct cgroupfs_root {
> unsigned long flags;
>
> /* IDs for cgroups in this hierarchy */
> - struct ida cgroup_ida;
> + struct idr cgroup_idr;
>
> /* The path to use for release notifications. */
> char release_agent_path[PATH_MAX];
> @@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
>
> simple_xattrs_free(&cgrp->xattrs);
>
> - ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
> + idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
> kfree(rcu_dereference_raw(cgrp->name));
> kfree(cgrp);
> }
> @@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>
> root->subsys_mask = opts->subsys_mask;
> root->flags = opts->flags;
> - ida_init(&root->cgroup_ida);
> + idr_init(&root->cgroup_idr);
> +
> if (opts->release_agent)
> strcpy(root->release_agent_path, opts->release_agent);
> if (opts->name)
> @@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
> spin_lock(&hierarchy_id_lock);
> ida_remove(&hierarchy_ida, root->hierarchy_id);
> spin_unlock(&hierarchy_id_lock);
> - ida_destroy(&root->cgroup_ida);
> + idr_destroy(&root->cgroup_idr);
> kfree(root);
> }
>
> @@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
> mutex_lock(&cgroup_mutex);
> mutex_lock(&cgroup_root_mutex);
>
> + root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
> + 0, 0, GFP_KERNEL);
> + if (root_cgrp->id < 0)
> + goto unlock_drop;
Ah. hmm, I'm sorry but css ID is allocated from "1" and 0 was an invalid number.
With this change, root cgroup will have 0.
If this change is intentional, please add comments in Changelog.
IIRC, swap_cgroup treats 0 as "unused" (root_memcg doesn't account anything...
so, I guess we'll not see troubles.) we need double check.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 2/8] cgroup: implement cgroup_from_id()
@ 2013-04-09 4:08 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:08 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:20), Li Zefan wrote:
> This will be used as a replacement for css_lookup().
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 31 +++++++++++++++++++++++++------
> 2 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 96072e4..6ae8ae1 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -732,6 +732,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css);
> struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
>
> bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
> +struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id);
>
> #else /* !CONFIG_CGROUPS */
>
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index e87872c..5ae1e87 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -139,7 +139,7 @@ struct cgroupfs_root {
> unsigned long flags;
>
> /* IDs for cgroups in this hierarchy */
> - struct ida cgroup_ida;
> + struct idr cgroup_idr;
>
> /* The path to use for release notifications. */
> char release_agent_path[PATH_MAX];
> @@ -908,7 +908,7 @@ static void cgroup_free_fn(struct work_struct *work)
>
> simple_xattrs_free(&cgrp->xattrs);
>
> - ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
> + idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
> kfree(rcu_dereference_raw(cgrp->name));
> kfree(cgrp);
> }
> @@ -1512,7 +1512,8 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
>
> root->subsys_mask = opts->subsys_mask;
> root->flags = opts->flags;
> - ida_init(&root->cgroup_ida);
> + idr_init(&root->cgroup_idr);
> +
> if (opts->release_agent)
> strcpy(root->release_agent_path, opts->release_agent);
> if (opts->name)
> @@ -1531,7 +1532,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
> spin_lock(&hierarchy_id_lock);
> ida_remove(&hierarchy_ida, root->hierarchy_id);
> spin_unlock(&hierarchy_id_lock);
> - ida_destroy(&root->cgroup_ida);
> + idr_destroy(&root->cgroup_idr);
> kfree(root);
> }
>
> @@ -1645,6 +1646,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
> mutex_lock(&cgroup_mutex);
> mutex_lock(&cgroup_root_mutex);
>
> + root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
> + 0, 0, GFP_KERNEL);
> + if (root_cgrp->id < 0)
> + goto unlock_drop;
Ah. hmm, I'm sorry but css ID is allocated from "1" and 0 was an invalid number.
With this change, root cgroup will have 0.
If this change is intentional, please add comments in Changelog.
IIRC, swap_cgroup treats 0 as "unused" (root_memcg doesn't account anything...
so, I guess we'll not see troubles.) we need double check.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* [PATCH 4/8] memcg: convert to use cgroup_from_id()
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 8:21 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
mm/memcontrol.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 14f1375..3561d0b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
*/
static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
{
- struct cgroup_subsys_state *css;
+ struct cgroup *cgrp;
/* ID 0 is unused ID */
if (!id)
return NULL;
- css = css_lookup(&mem_cgroup_subsys, id);
- if (!css)
+ cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
+ if (!cgrp)
return NULL;
- return mem_cgroup_from_css(css);
+ return mem_cgroup_from_cont(cgrp);
}
struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-08 8:21 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 14f1375..3561d0b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
*/
static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
{
- struct cgroup_subsys_state *css;
+ struct cgroup *cgrp;
/* ID 0 is unused ID */
if (!id)
return NULL;
- css = css_lookup(&mem_cgroup_subsys, id);
- if (!css)
+ cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
+ if (!cgrp)
return NULL;
- return mem_cgroup_from_css(css);
+ return mem_cgroup_from_cont(cgrp);
}
struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-08 8:21 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 14f1375..3561d0b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
*/
static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
{
- struct cgroup_subsys_state *css;
+ struct cgroup *cgrp;
/* ID 0 is unused ID */
if (!id)
return NULL;
- css = css_lookup(&mem_cgroup_subsys, id);
- if (!css)
+ cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
+ if (!cgrp)
return NULL;
- return mem_cgroup_from_css(css);
+ return mem_cgroup_from_cont(cgrp);
}
struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
--
1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 98+ messages in thread* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
2013-04-08 8:21 ` Li Zefan
@ 2013-04-08 14:53 ` Michal Hocko
-1 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:53 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:21:29, Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
I would be tempted to stuff this into the same patch which introduces
cgroup_from_id but this is just a minor thing.
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 14f1375..3561d0b 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
> */
> static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
> {
> - struct cgroup_subsys_state *css;
> + struct cgroup *cgrp;
>
> /* ID 0 is unused ID */
> if (!id)
> return NULL;
> - css = css_lookup(&mem_cgroup_subsys, id);
> - if (!css)
> + cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
> + if (!cgrp)
> return NULL;
> - return mem_cgroup_from_css(css);
> + return mem_cgroup_from_cont(cgrp);
> }
>
> struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
> --
> 1.8.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-08 14:53 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:53 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:21:29, Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
I would be tempted to stuff this into the same patch which introduces
cgroup_from_id but this is just a minor thing.
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 14f1375..3561d0b 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
> */
> static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
> {
> - struct cgroup_subsys_state *css;
> + struct cgroup *cgrp;
>
> /* ID 0 is unused ID */
> if (!id)
> return NULL;
> - css = css_lookup(&mem_cgroup_subsys, id);
> - if (!css)
> + cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
> + if (!cgrp)
> return NULL;
> - return mem_cgroup_from_css(css);
> + return mem_cgroup_from_cont(cgrp);
> }
>
> struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
> --
> 1.8.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread[parent not found: <20130408145333.GL17178-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>]
* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
2013-04-08 14:53 ` Michal Hocko
(?)
@ 2013-04-09 3:00 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:00 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
On 2013/4/8 22:53, Michal Hocko wrote:
> On Mon 08-04-13 16:21:29, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>
> I would be tempted to stuff this into the same patch which introduces
> cgroup_from_id but this is just a minor thing.
>
yeah it's not a big deal, just want to separate changes to cgroup and memcg.
> Acked-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
>
>> ---
>> mm/memcontrol.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 14f1375..3561d0b 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
>> */
>> static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
>> {
>> - struct cgroup_subsys_state *css;
>> + struct cgroup *cgrp;
>>
>> /* ID 0 is unused ID */
>> if (!id)
>> return NULL;
>> - css = css_lookup(&mem_cgroup_subsys, id);
>> - if (!css)
>> + cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
>> + if (!cgrp)
>> return NULL;
>> - return mem_cgroup_from_css(css);
>> + return mem_cgroup_from_cont(cgrp);
>> }
>>
>> struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
>> --
>> 1.8.0.2
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-09 3:00 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:00 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 22:53, Michal Hocko wrote:
> On Mon 08-04-13 16:21:29, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan@huawei.com>
>
> I would be tempted to stuff this into the same patch which introduces
> cgroup_from_id but this is just a minor thing.
>
yeah it's not a big deal, just want to separate changes to cgroup and memcg.
> Acked-by: Michal Hocko <mhocko@suse.cz>
>
>> ---
>> mm/memcontrol.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 14f1375..3561d0b 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
>> */
>> static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
>> {
>> - struct cgroup_subsys_state *css;
>> + struct cgroup *cgrp;
>>
>> /* ID 0 is unused ID */
>> if (!id)
>> return NULL;
>> - css = css_lookup(&mem_cgroup_subsys, id);
>> - if (!css)
>> + cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
>> + if (!cgrp)
>> return NULL;
>> - return mem_cgroup_from_css(css);
>> + return mem_cgroup_from_cont(cgrp);
>> }
>>
>> struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
>> --
>> 1.8.0.2
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-09 3:00 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:00 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 22:53, Michal Hocko wrote:
> On Mon 08-04-13 16:21:29, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan@huawei.com>
>
> I would be tempted to stuff this into the same patch which introduces
> cgroup_from_id but this is just a minor thing.
>
yeah it's not a big deal, just want to separate changes to cgroup and memcg.
> Acked-by: Michal Hocko <mhocko@suse.cz>
>
>> ---
>> mm/memcontrol.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 14f1375..3561d0b 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -2769,15 +2769,15 @@ static void __mem_cgroup_cancel_local_charge(struct mem_cgroup *memcg,
>> */
>> static struct mem_cgroup *mem_cgroup_lookup(unsigned short id)
>> {
>> - struct cgroup_subsys_state *css;
>> + struct cgroup *cgrp;
>>
>> /* ID 0 is unused ID */
>> if (!id)
>> return NULL;
>> - css = css_lookup(&mem_cgroup_subsys, id);
>> - if (!css)
>> + cgrp = cgroup_from_id(&mem_cgroup_subsys, id);
>> + if (!cgrp)
>> return NULL;
>> - return mem_cgroup_from_css(css);
>> + return mem_cgroup_from_cont(cgrp);
>> }
>>
>> struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
>> --
>> 1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
[parent not found: <51627E09.5010605-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
2013-04-08 8:21 ` Li Zefan
(?)
@ 2013-04-09 3:59 ` Kamezawa Hiroyuki
-1 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 3:59 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
(2013/04/08 17:21), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Acked-by: KAMEZAWA Hiroyoku <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-09 3:59 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 3:59 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:21), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Acked-by: KAMEZAWA Hiroyoku <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 4/8] memcg: convert to use cgroup_from_id()
@ 2013-04-09 3:59 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 3:59 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:21), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Acked-by: KAMEZAWA Hiroyoku <kamezawa.hiroyu@jp.fujitsu.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* [PATCH 5/8] memcg: convert to use cgroup->id
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 8:22 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
mm/memcontrol.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3561d0b..c4e0173 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
+{
+ return memcg->css.cgroup->id;
+}
+
/* Writing them here to avoid exposing memcg's inner layout */
#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
@@ -4234,7 +4239,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
* css_get() was called in uncharge().
*/
if (do_swap_account && swapout && memcg)
- swap_cgroup_record(ent, css_id(&memcg->css));
+ swap_cgroup_record(ent, mem_cgroup_id(memcg));
}
#endif
@@ -4286,8 +4291,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
{
unsigned short old_id, new_id;
- old_id = css_id(&from->css);
- new_id = css_id(&to->css);
+ old_id = mem_cgroup_id(from);
+ new_id = mem_cgroup_id(to);
if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
mem_cgroup_swap_statistics(from, false);
@@ -6428,7 +6433,7 @@ static enum mc_target_type get_mctgt_type(struct vm_area_struct *vma,
}
/* There is a swap entry and a page doesn't exist or isn't charged */
if (ent.val && !ret &&
- css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) {
+ mem_cgroup_id(mc.from) == lookup_swap_cgroup_id(ent)) {
ret = MC_TARGET_SWAP;
if (target)
target->ent = ent;
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-08 8:22 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3561d0b..c4e0173 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
+{
+ return memcg->css.cgroup->id;
+}
+
/* Writing them here to avoid exposing memcg's inner layout */
#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
@@ -4234,7 +4239,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
* css_get() was called in uncharge().
*/
if (do_swap_account && swapout && memcg)
- swap_cgroup_record(ent, css_id(&memcg->css));
+ swap_cgroup_record(ent, mem_cgroup_id(memcg));
}
#endif
@@ -4286,8 +4291,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
{
unsigned short old_id, new_id;
- old_id = css_id(&from->css);
- new_id = css_id(&to->css);
+ old_id = mem_cgroup_id(from);
+ new_id = mem_cgroup_id(to);
if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
mem_cgroup_swap_statistics(from, false);
@@ -6428,7 +6433,7 @@ static enum mc_target_type get_mctgt_type(struct vm_area_struct *vma,
}
/* There is a swap entry and a page doesn't exist or isn't charged */
if (ent.val && !ret &&
- css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) {
+ mem_cgroup_id(mc.from) == lookup_swap_cgroup_id(ent)) {
ret = MC_TARGET_SWAP;
if (target)
target->ent = ent;
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-08 8:22 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
This is a preparation to kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3561d0b..c4e0173 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
+{
+ return memcg->css.cgroup->id;
+}
+
/* Writing them here to avoid exposing memcg's inner layout */
#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
@@ -4234,7 +4239,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
* css_get() was called in uncharge().
*/
if (do_swap_account && swapout && memcg)
- swap_cgroup_record(ent, css_id(&memcg->css));
+ swap_cgroup_record(ent, mem_cgroup_id(memcg));
}
#endif
@@ -4286,8 +4291,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
{
unsigned short old_id, new_id;
- old_id = css_id(&from->css);
- new_id = css_id(&to->css);
+ old_id = mem_cgroup_id(from);
+ new_id = mem_cgroup_id(to);
if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
mem_cgroup_swap_statistics(from, false);
@@ -6428,7 +6433,7 @@ static enum mc_target_type get_mctgt_type(struct vm_area_struct *vma,
}
/* There is a swap entry and a page doesn't exist or isn't charged */
if (ent.val && !ret &&
- css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) {
+ mem_cgroup_id(mc.from) == lookup_swap_cgroup_id(ent)) {
ret = MC_TARGET_SWAP;
if (target)
target->ent = ent;
--
1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 98+ messages in thread* Re: [PATCH 5/8] memcg: convert to use cgroup->id
2013-04-08 8:22 ` Li Zefan
@ 2013-04-08 14:57 ` Michal Hocko
-1 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:57 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:22:11, Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
This patch depends on the following patch, doesn't it? There is no
guarantee that id fits into short right now. Not such a big deal but
would be nicer to have that guarantee for bisectability.
The patch on its own looks good.
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3561d0b..c4e0173 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -492,6 +492,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> return (memcg == root_mem_cgroup);
> }
>
> +static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> +{
> + return memcg->css.cgroup->id;
> +}
> +
> /* Writing them here to avoid exposing memcg's inner layout */
> #if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
>
> @@ -4234,7 +4239,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
> * css_get() was called in uncharge().
> */
> if (do_swap_account && swapout && memcg)
> - swap_cgroup_record(ent, css_id(&memcg->css));
> + swap_cgroup_record(ent, mem_cgroup_id(memcg));
> }
> #endif
>
> @@ -4286,8 +4291,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
> {
> unsigned short old_id, new_id;
>
> - old_id = css_id(&from->css);
> - new_id = css_id(&to->css);
> + old_id = mem_cgroup_id(from);
> + new_id = mem_cgroup_id(to);
>
> if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
> mem_cgroup_swap_statistics(from, false);
> @@ -6428,7 +6433,7 @@ static enum mc_target_type get_mctgt_type(struct vm_area_struct *vma,
> }
> /* There is a swap entry and a page doesn't exist or isn't charged */
> if (ent.val && !ret &&
> - css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) {
> + mem_cgroup_id(mc.from) == lookup_swap_cgroup_id(ent)) {
> ret = MC_TARGET_SWAP;
> if (target)
> target->ent = ent;
> --
> 1.8.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-08 14:57 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:57 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:22:11, Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
This patch depends on the following patch, doesn't it? There is no
guarantee that id fits into short right now. Not such a big deal but
would be nicer to have that guarantee for bisectability.
The patch on its own looks good.
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3561d0b..c4e0173 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -492,6 +492,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> return (memcg == root_mem_cgroup);
> }
>
> +static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> +{
> + return memcg->css.cgroup->id;
> +}
> +
> /* Writing them here to avoid exposing memcg's inner layout */
> #if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
>
> @@ -4234,7 +4239,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
> * css_get() was called in uncharge().
> */
> if (do_swap_account && swapout && memcg)
> - swap_cgroup_record(ent, css_id(&memcg->css));
> + swap_cgroup_record(ent, mem_cgroup_id(memcg));
> }
> #endif
>
> @@ -4286,8 +4291,8 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
> {
> unsigned short old_id, new_id;
>
> - old_id = css_id(&from->css);
> - new_id = css_id(&to->css);
> + old_id = mem_cgroup_id(from);
> + new_id = mem_cgroup_id(to);
>
> if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
> mem_cgroup_swap_statistics(from, false);
> @@ -6428,7 +6433,7 @@ static enum mc_target_type get_mctgt_type(struct vm_area_struct *vma,
> }
> /* There is a swap entry and a page doesn't exist or isn't charged */
> if (ent.val && !ret &&
> - css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) {
> + mem_cgroup_id(mc.from) == lookup_swap_cgroup_id(ent)) {
> ret = MC_TARGET_SWAP;
> if (target)
> target->ent = ent;
> --
> 1.8.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread[parent not found: <20130408145702.GM17178-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>]
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
2013-04-08 14:57 ` Michal Hocko
(?)
@ 2013-04-09 3:02 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:02 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
On 2013/4/8 22:57, Michal Hocko wrote:
> On Mon 08-04-13 16:22:11, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>
> This patch depends on the following patch, doesn't it? There is no
> guarantee that id fits into short right now. Not such a big deal but
> would be nicer to have that guarantee for bisectability.
>
Not necessary, because css_id still prevents us from creating too
many cgroups.
> The patch on its own looks good.
>
> Acked-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-09 3:02 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:02 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 22:57, Michal Hocko wrote:
> On Mon 08-04-13 16:22:11, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan@huawei.com>
>
> This patch depends on the following patch, doesn't it? There is no
> guarantee that id fits into short right now. Not such a big deal but
> would be nicer to have that guarantee for bisectability.
>
Not necessary, because css_id still prevents us from creating too
many cgroups.
> The patch on its own looks good.
>
> Acked-by: Michal Hocko <mhocko@suse.cz>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-09 3:02 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-09 3:02 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On 2013/4/8 22:57, Michal Hocko wrote:
> On Mon 08-04-13 16:22:11, Li Zefan wrote:
>> This is a preparation to kill css_id.
>>
>> Signed-off-by: Li Zefan <lizefan@huawei.com>
>
> This patch depends on the following patch, doesn't it? There is no
> guarantee that id fits into short right now. Not such a big deal but
> would be nicer to have that guarantee for bisectability.
>
Not necessary, because css_id still prevents us from creating too
many cgroups.
> The patch on its own looks good.
>
> Acked-by: Michal Hocko <mhocko@suse.cz>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
2013-04-09 3:02 ` Li Zefan
@ 2013-04-09 6:49 ` Michal Hocko
-1 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-09 6:49 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Tue 09-04-13 11:02:20, Li Zefan wrote:
> On 2013/4/8 22:57, Michal Hocko wrote:
> > On Mon 08-04-13 16:22:11, Li Zefan wrote:
> >> This is a preparation to kill css_id.
> >>
> >> Signed-off-by: Li Zefan <lizefan@huawei.com>
> >
> > This patch depends on the following patch, doesn't it? There is no
> > guarantee that id fits into short right now. Not such a big deal but
> > would be nicer to have that guarantee for bisectability.
> >
>
> Not necessary, because css_id still prevents us from creating too
> many cgroups.
Right you are.
Thanks
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-09 6:49 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-09 6:49 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Tue 09-04-13 11:02:20, Li Zefan wrote:
> On 2013/4/8 22:57, Michal Hocko wrote:
> > On Mon 08-04-13 16:22:11, Li Zefan wrote:
> >> This is a preparation to kill css_id.
> >>
> >> Signed-off-by: Li Zefan <lizefan@huawei.com>
> >
> > This patch depends on the following patch, doesn't it? There is no
> > guarantee that id fits into short right now. Not such a big deal but
> > would be nicer to have that guarantee for bisectability.
> >
>
> Not necessary, because css_id still prevents us from creating too
> many cgroups.
Right you are.
Thanks
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread
[parent not found: <51627E33.4090107-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
2013-04-08 8:22 ` Li Zefan
(?)
@ 2013-04-09 4:02 ` Kamezawa Hiroyuki
-1 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:02 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
(2013/04/08 17:22), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-09 4:02 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:02 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:22), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 5/8] memcg: convert to use cgroup->id
@ 2013-04-09 4:02 ` Kamezawa Hiroyuki
0 siblings, 0 replies; 98+ messages in thread
From: Kamezawa Hiroyuki @ 2013-04-09 4:02 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
(2013/04/08 17:22), Li Zefan wrote:
> This is a preparation to kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* [PATCH 6/8] memcg: fail to create cgroup if the cgroup id is too big
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 8:22 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
memcg requires the cgroup id to be smaller than 65536.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
mm/memcontrol.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c4e0173..947dff1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,12 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+/*
+ * We restrict the id in the range of [0, 65535], so it can fit into
+ * an unsigned short.
+ */
+#define MEM_CGROUP_ID_MAX (65535)
+
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
{
return memcg->css.cgroup->id;
@@ -6125,6 +6131,9 @@ mem_cgroup_css_alloc(struct cgroup *cont)
long error = -ENOMEM;
int node;
+ if (cont->id > MEM_CGROUP_ID_MAX)
+ return ERR_PTR(-ENOSPC);
+
memcg = mem_cgroup_alloc();
if (!memcg)
return ERR_PTR(error);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 6/8] memcg: fail to create cgroup if the cgroup id is too big
@ 2013-04-08 8:22 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
memcg requires the cgroup id to be smaller than 65536.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c4e0173..947dff1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,12 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+/*
+ * We restrict the id in the range of [0, 65535], so it can fit into
+ * an unsigned short.
+ */
+#define MEM_CGROUP_ID_MAX (65535)
+
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
{
return memcg->css.cgroup->id;
@@ -6125,6 +6131,9 @@ mem_cgroup_css_alloc(struct cgroup *cont)
long error = -ENOMEM;
int node;
+ if (cont->id > MEM_CGROUP_ID_MAX)
+ return ERR_PTR(-ENOSPC);
+
memcg = mem_cgroup_alloc();
if (!memcg)
return ERR_PTR(error);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 6/8] memcg: fail to create cgroup if the cgroup id is too big
@ 2013-04-08 8:22 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:22 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
memcg requires the cgroup id to be smaller than 65536.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
mm/memcontrol.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c4e0173..947dff1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -492,6 +492,12 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
return (memcg == root_mem_cgroup);
}
+/*
+ * We restrict the id in the range of [0, 65535], so it can fit into
+ * an unsigned short.
+ */
+#define MEM_CGROUP_ID_MAX (65535)
+
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
{
return memcg->css.cgroup->id;
@@ -6125,6 +6131,9 @@ mem_cgroup_css_alloc(struct cgroup *cont)
long error = -ENOMEM;
int node;
+ if (cont->id > MEM_CGROUP_ID_MAX)
+ return ERR_PTR(-ENOSPC);
+
memcg = mem_cgroup_alloc();
if (!memcg)
return ERR_PTR(error);
--
1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 98+ messages in thread* Re: [PATCH 6/8] memcg: fail to create cgroup if the cgroup id is too big
2013-04-08 8:22 ` Li Zefan
@ 2013-04-08 15:01 ` Michal Hocko
-1 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 15:01 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:22:34, Li Zefan wrote:
> memcg requires the cgroup id to be smaller than 65536.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
But this should be moved up the patch stack as mentioned in the previous
email.
Acked-by: Michal Hocko <mhocko@suse.cz>
Minor nit bellow.
> ---
> mm/memcontrol.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c4e0173..947dff1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -492,6 +492,12 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> return (memcg == root_mem_cgroup);
> }
>
> +/*
> + * We restrict the id in the range of [0, 65535], so it can fit into
> + * an unsigned short.
> + */
> +#define MEM_CGROUP_ID_MAX (65535)
USHRT_MAX ?
> +
> static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> {
> return memcg->css.cgroup->id;
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread* Re: [PATCH 6/8] memcg: fail to create cgroup if the cgroup id is too big
@ 2013-04-08 15:01 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 15:01 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:22:34, Li Zefan wrote:
> memcg requires the cgroup id to be smaller than 65536.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
But this should be moved up the patch stack as mentioned in the previous
email.
Acked-by: Michal Hocko <mhocko@suse.cz>
Minor nit bellow.
> ---
> mm/memcontrol.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c4e0173..947dff1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -492,6 +492,12 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> return (memcg == root_mem_cgroup);
> }
>
> +/*
> + * We restrict the id in the range of [0, 65535], so it can fit into
> + * an unsigned short.
> + */
> +#define MEM_CGROUP_ID_MAX (65535)
USHRT_MAX ?
> +
> static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> {
> return memcg->css.cgroup->id;
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread
* [PATCH 8/8] cgroup: kill css_id
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 8:23 ` Li Zefan
-1 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
The only user of css_id was memcg, and it has been converted to
use cgroup->id, so kill css_id.
Signed-off-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
include/linux/cgroup.h | 38 --------
kernel/cgroup.c | 258 -------------------------------------------------
2 files changed, 296 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 6ae8ae1..d2c06db 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -495,11 +495,6 @@ struct cgroup_subsys {
int active;
int disabled;
int early_init;
- /*
- * True if this subsys uses ID. ID is not available before cgroup_init()
- * (not available in early_init time.)
- */
- bool use_id;
/*
* If %false, this subsystem is properly hierarchical -
@@ -525,9 +520,6 @@ struct cgroup_subsys {
*/
struct cgroupfs_root *root;
struct list_head sibling;
- /* used when use_id == true */
- struct idr idr;
- spinlock_t id_lock;
/* list of cftype_sets */
struct list_head cftsets;
@@ -699,36 +691,6 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
bool threadgroup);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
-/*
- * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
- * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
- * CSS ID is assigned at cgroup allocation (create) automatically
- * and removed when subsys calls free_css_id() function. This is because
- * the lifetime of cgroup_subsys_state is subsys's matter.
- *
- * Looking up and scanning function should be called under rcu_read_lock().
- * Taking cgroup_mutex is not necessary for following calls.
- * But the css returned by this routine can be "not populated yet" or "being
- * destroyed". The caller should check css and cgroup's status.
- */
-
-/*
- * Typically Called at ->destroy(), or somewhere the subsys frees
- * cgroup_subsys_state.
- */
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
-
-/* Find a cgroup_subsys_state which has given ID */
-
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
-
-/* Returns true if root is ancestor of cg */
-bool css_is_ancestor(struct cgroup_subsys_state *cg,
- const struct cgroup_subsys_state *root);
-
-/* Get id and depth of css */
-unsigned short css_id(struct cgroup_subsys_state *css);
-unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5ae1e87..2389484 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -165,38 +165,6 @@ struct cfent {
};
/*
- * CSS ID -- ID per subsys's Cgroup Subsys State(CSS). used only when
- * cgroup_subsys->use_id != 0.
- */
-#define CSS_ID_MAX (65535)
-struct css_id {
- /*
- * The css to which this ID points. This pointer is set to valid value
- * after cgroup is populated. If cgroup is removed, this will be NULL.
- * This pointer is expected to be RCU-safe because destroy()
- * is called after synchronize_rcu(). But for safe use, css_tryget()
- * should be used for avoiding race.
- */
- struct cgroup_subsys_state __rcu *css;
- /*
- * ID of this css.
- */
- unsigned short id;
- /*
- * Depth in hierarchy which this ID belongs to.
- */
- unsigned short depth;
- /*
- * ID is freed by RCU. (and lookup routine is RCU safe.)
- */
- struct rcu_head rcu_head;
- /*
- * Hierarchy of CSS ID belongs to.
- */
- unsigned short stack[0]; /* Array of Length (depth+1) */
-};
-
-/*
* cgroup_event represents events which userspace want to receive.
*/
struct cgroup_event {
@@ -363,9 +331,6 @@ struct cg_cgroup_link {
static struct css_set init_css_set;
static struct cg_cgroup_link init_css_set_link;
-static int cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *css);
-
/* css_set_lock protects the list of css_set objects, and the
* chain of tasks off each css_set. Nests outside task->alloc_lock
* due to cgroup_iter_start() */
@@ -843,9 +808,6 @@ static struct backing_dev_info cgroup_backing_dev_info = {
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
};
-static int alloc_css_id(struct cgroup_subsys *ss,
- struct cgroup *parent, struct cgroup *child);
-
static struct inode *cgroup_new_inode(umode_t mode, struct super_block *sb)
{
struct inode *inode = new_inode(sb);
@@ -4002,18 +3964,6 @@ static int cgroup_populate_dir(struct cgroup *cgrp, bool base_files,
cgroup_addrm_files(cgrp, ss, set->cfts, true);
}
- /* This cgroup is ready now */
- for_each_subsys(cgrp->root, ss) {
- struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
- /*
- * Update id->css pointer and make this css visible from
- * CSS ID functions. This pointer will be dereferened
- * from RCU-read-side without locks.
- */
- if (css->id)
- rcu_assign_pointer(css->id->css, css);
- }
-
return 0;
}
@@ -4158,11 +4108,6 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_all;
}
init_cgroup_css(css, ss, cgrp);
- if (ss->use_id) {
- err = alloc_css_id(ss, parent, cgrp);
- if (err)
- goto err_free_all;
- }
}
/*
@@ -4448,12 +4393,6 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* our new subsystem will be attached to the dummy hierarchy. */
init_cgroup_css(css, ss, dummytop);
- /* init_idr must be after init_cgroup_css because it sets css->id. */
- if (ss->use_id) {
- ret = cgroup_init_idr(ss, css);
- if (ret)
- goto err_unload;
- }
/*
* Now we need to entangle the css into the existing css_sets. unlike
@@ -4521,9 +4460,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
offline_css(ss, dummytop);
ss->active = 0;
- if (ss->use_id)
- idr_destroy(&ss->idr);
-
/* deassign the subsys_id */
subsys[ss->subsys_id] = NULL;
@@ -4631,8 +4567,6 @@ int __init cgroup_init(void)
continue;
if (!ss->early_init)
cgroup_init_subsys(ss);
- if (ss->use_id)
- cgroup_init_idr(ss, init_css_set.subsys[ss->subsys_id]);
}
/* Add init_css_set to the hash table */
@@ -5092,198 +5026,6 @@ static int __init cgroup_disable(char *str)
__setup("cgroup_disable=", cgroup_disable);
/*
- * Functons for CSS ID.
- */
-
-/*
- *To get ID other than 0, this should be called when !cgroup_is_removed().
- */
-unsigned short css_id(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- /*
- * This css_id() can return correct value when somone has refcnt
- * on this or this is under rcu_read_lock(). Once css->id is allocated,
- * it's unchanged until freed.
- */
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->id;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_id);
-
-unsigned short css_depth(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->depth;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_depth);
-
-/**
- * css_is_ancestor - test "root" css is an ancestor of "child"
- * @child: the css to be tested.
- * @root: the css supporsed to be an ancestor of the child.
- *
- * Returns true if "root" is an ancestor of "child" in its hierarchy. Because
- * this function reads css->id, the caller must hold rcu_read_lock().
- * But, considering usual usage, the csses should be valid objects after test.
- * Assuming that the caller will do some action to the child if this returns
- * returns true, the caller must take "child";s reference count.
- * If "child" is valid object and this returns true, "root" is valid, too.
- */
-
-bool css_is_ancestor(struct cgroup_subsys_state *child,
- const struct cgroup_subsys_state *root)
-{
- struct css_id *child_id;
- struct css_id *root_id;
-
- child_id = rcu_dereference(child->id);
- if (!child_id)
- return false;
- root_id = rcu_dereference(root->id);
- if (!root_id)
- return false;
- if (child_id->depth < root_id->depth)
- return false;
- if (child_id->stack[root_id->depth] != root_id->id)
- return false;
- return true;
-}
-
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css)
-{
- struct css_id *id = css->id;
- /* When this is called before css_id initialization, id can be NULL */
- if (!id)
- return;
-
- BUG_ON(!ss->use_id);
-
- rcu_assign_pointer(id->css, NULL);
- rcu_assign_pointer(css->id, NULL);
- spin_lock(&ss->id_lock);
- idr_remove(&ss->idr, id->id);
- spin_unlock(&ss->id_lock);
- kfree_rcu(id, rcu_head);
-}
-EXPORT_SYMBOL_GPL(free_css_id);
-
-/*
- * This is called by init or create(). Then, calls to this function are
- * always serialized (By cgroup_mutex() at create()).
- */
-
-static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
-{
- struct css_id *newid;
- int ret, size;
-
- BUG_ON(!ss->use_id);
-
- size = sizeof(*newid) + sizeof(unsigned short) * (depth + 1);
- newid = kzalloc(size, GFP_KERNEL);
- if (!newid)
- return ERR_PTR(-ENOMEM);
-
- idr_preload(GFP_KERNEL);
- spin_lock(&ss->id_lock);
- /* Don't use 0. allocates an ID of 1-65535 */
- ret = idr_alloc(&ss->idr, newid, 1, CSS_ID_MAX + 1, GFP_NOWAIT);
- spin_unlock(&ss->id_lock);
- idr_preload_end();
-
- /* Returns error when there are no free spaces for new ID.*/
- if (ret < 0)
- goto err_out;
-
- newid->id = ret;
- newid->depth = depth;
- return newid;
-err_out:
- kfree(newid);
- return ERR_PTR(ret);
-
-}
-
-static int __init_or_module cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *rootcss)
-{
- struct css_id *newid;
-
- spin_lock_init(&ss->id_lock);
- idr_init(&ss->idr);
-
- newid = get_new_cssid(ss, 0);
- if (IS_ERR(newid))
- return PTR_ERR(newid);
-
- newid->stack[0] = newid->id;
- newid->css = rootcss;
- rootcss->id = newid;
- return 0;
-}
-
-static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
- struct cgroup *child)
-{
- int subsys_id, i, depth = 0;
- struct cgroup_subsys_state *parent_css, *child_css;
- struct css_id *child_id, *parent_id;
-
- subsys_id = ss->subsys_id;
- parent_css = parent->subsys[subsys_id];
- child_css = child->subsys[subsys_id];
- parent_id = parent_css->id;
- depth = parent_id->depth + 1;
-
- child_id = get_new_cssid(ss, depth);
- if (IS_ERR(child_id))
- return PTR_ERR(child_id);
-
- for (i = 0; i < depth; i++)
- child_id->stack[i] = parent_id->stack[i];
- child_id->stack[depth] = child_id->id;
- /*
- * child_id->css pointer will be set after this cgroup is available
- * see cgroup_populate_dir()
- */
- rcu_assign_pointer(child_css->id, child_id);
-
- return 0;
-}
-
-/**
- * css_lookup - lookup css by id
- * @ss: cgroup subsys to be looked into.
- * @id: the id
- *
- * Returns pointer to cgroup_subsys_state if there is valid one with id.
- * NULL if not. Should be called under rcu_read_lock()
- */
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id)
-{
- struct css_id *cssid = NULL;
-
- BUG_ON(!ss->use_id);
- cssid = idr_find(&ss->idr, id);
-
- if (unlikely(!cssid))
- return NULL;
-
- return rcu_dereference(cssid->css);
-}
-EXPORT_SYMBOL_GPL(css_lookup);
-
-/*
* get corresponding css from file open on cgroupfs directory
*/
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 8/8] cgroup: kill css_id
@ 2013-04-08 8:23 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
The only user of css_id was memcg, and it has been converted to
use cgroup->id, so kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
include/linux/cgroup.h | 38 --------
kernel/cgroup.c | 258 -------------------------------------------------
2 files changed, 296 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 6ae8ae1..d2c06db 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -495,11 +495,6 @@ struct cgroup_subsys {
int active;
int disabled;
int early_init;
- /*
- * True if this subsys uses ID. ID is not available before cgroup_init()
- * (not available in early_init time.)
- */
- bool use_id;
/*
* If %false, this subsystem is properly hierarchical -
@@ -525,9 +520,6 @@ struct cgroup_subsys {
*/
struct cgroupfs_root *root;
struct list_head sibling;
- /* used when use_id == true */
- struct idr idr;
- spinlock_t id_lock;
/* list of cftype_sets */
struct list_head cftsets;
@@ -699,36 +691,6 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
bool threadgroup);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
-/*
- * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
- * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
- * CSS ID is assigned at cgroup allocation (create) automatically
- * and removed when subsys calls free_css_id() function. This is because
- * the lifetime of cgroup_subsys_state is subsys's matter.
- *
- * Looking up and scanning function should be called under rcu_read_lock().
- * Taking cgroup_mutex is not necessary for following calls.
- * But the css returned by this routine can be "not populated yet" or "being
- * destroyed". The caller should check css and cgroup's status.
- */
-
-/*
- * Typically Called at ->destroy(), or somewhere the subsys frees
- * cgroup_subsys_state.
- */
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
-
-/* Find a cgroup_subsys_state which has given ID */
-
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
-
-/* Returns true if root is ancestor of cg */
-bool css_is_ancestor(struct cgroup_subsys_state *cg,
- const struct cgroup_subsys_state *root);
-
-/* Get id and depth of css */
-unsigned short css_id(struct cgroup_subsys_state *css);
-unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5ae1e87..2389484 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -165,38 +165,6 @@ struct cfent {
};
/*
- * CSS ID -- ID per subsys's Cgroup Subsys State(CSS). used only when
- * cgroup_subsys->use_id != 0.
- */
-#define CSS_ID_MAX (65535)
-struct css_id {
- /*
- * The css to which this ID points. This pointer is set to valid value
- * after cgroup is populated. If cgroup is removed, this will be NULL.
- * This pointer is expected to be RCU-safe because destroy()
- * is called after synchronize_rcu(). But for safe use, css_tryget()
- * should be used for avoiding race.
- */
- struct cgroup_subsys_state __rcu *css;
- /*
- * ID of this css.
- */
- unsigned short id;
- /*
- * Depth in hierarchy which this ID belongs to.
- */
- unsigned short depth;
- /*
- * ID is freed by RCU. (and lookup routine is RCU safe.)
- */
- struct rcu_head rcu_head;
- /*
- * Hierarchy of CSS ID belongs to.
- */
- unsigned short stack[0]; /* Array of Length (depth+1) */
-};
-
-/*
* cgroup_event represents events which userspace want to receive.
*/
struct cgroup_event {
@@ -363,9 +331,6 @@ struct cg_cgroup_link {
static struct css_set init_css_set;
static struct cg_cgroup_link init_css_set_link;
-static int cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *css);
-
/* css_set_lock protects the list of css_set objects, and the
* chain of tasks off each css_set. Nests outside task->alloc_lock
* due to cgroup_iter_start() */
@@ -843,9 +808,6 @@ static struct backing_dev_info cgroup_backing_dev_info = {
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
};
-static int alloc_css_id(struct cgroup_subsys *ss,
- struct cgroup *parent, struct cgroup *child);
-
static struct inode *cgroup_new_inode(umode_t mode, struct super_block *sb)
{
struct inode *inode = new_inode(sb);
@@ -4002,18 +3964,6 @@ static int cgroup_populate_dir(struct cgroup *cgrp, bool base_files,
cgroup_addrm_files(cgrp, ss, set->cfts, true);
}
- /* This cgroup is ready now */
- for_each_subsys(cgrp->root, ss) {
- struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
- /*
- * Update id->css pointer and make this css visible from
- * CSS ID functions. This pointer will be dereferened
- * from RCU-read-side without locks.
- */
- if (css->id)
- rcu_assign_pointer(css->id->css, css);
- }
-
return 0;
}
@@ -4158,11 +4108,6 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_all;
}
init_cgroup_css(css, ss, cgrp);
- if (ss->use_id) {
- err = alloc_css_id(ss, parent, cgrp);
- if (err)
- goto err_free_all;
- }
}
/*
@@ -4448,12 +4393,6 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* our new subsystem will be attached to the dummy hierarchy. */
init_cgroup_css(css, ss, dummytop);
- /* init_idr must be after init_cgroup_css because it sets css->id. */
- if (ss->use_id) {
- ret = cgroup_init_idr(ss, css);
- if (ret)
- goto err_unload;
- }
/*
* Now we need to entangle the css into the existing css_sets. unlike
@@ -4521,9 +4460,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
offline_css(ss, dummytop);
ss->active = 0;
- if (ss->use_id)
- idr_destroy(&ss->idr);
-
/* deassign the subsys_id */
subsys[ss->subsys_id] = NULL;
@@ -4631,8 +4567,6 @@ int __init cgroup_init(void)
continue;
if (!ss->early_init)
cgroup_init_subsys(ss);
- if (ss->use_id)
- cgroup_init_idr(ss, init_css_set.subsys[ss->subsys_id]);
}
/* Add init_css_set to the hash table */
@@ -5092,198 +5026,6 @@ static int __init cgroup_disable(char *str)
__setup("cgroup_disable=", cgroup_disable);
/*
- * Functons for CSS ID.
- */
-
-/*
- *To get ID other than 0, this should be called when !cgroup_is_removed().
- */
-unsigned short css_id(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- /*
- * This css_id() can return correct value when somone has refcnt
- * on this or this is under rcu_read_lock(). Once css->id is allocated,
- * it's unchanged until freed.
- */
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->id;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_id);
-
-unsigned short css_depth(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->depth;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_depth);
-
-/**
- * css_is_ancestor - test "root" css is an ancestor of "child"
- * @child: the css to be tested.
- * @root: the css supporsed to be an ancestor of the child.
- *
- * Returns true if "root" is an ancestor of "child" in its hierarchy. Because
- * this function reads css->id, the caller must hold rcu_read_lock().
- * But, considering usual usage, the csses should be valid objects after test.
- * Assuming that the caller will do some action to the child if this returns
- * returns true, the caller must take "child";s reference count.
- * If "child" is valid object and this returns true, "root" is valid, too.
- */
-
-bool css_is_ancestor(struct cgroup_subsys_state *child,
- const struct cgroup_subsys_state *root)
-{
- struct css_id *child_id;
- struct css_id *root_id;
-
- child_id = rcu_dereference(child->id);
- if (!child_id)
- return false;
- root_id = rcu_dereference(root->id);
- if (!root_id)
- return false;
- if (child_id->depth < root_id->depth)
- return false;
- if (child_id->stack[root_id->depth] != root_id->id)
- return false;
- return true;
-}
-
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css)
-{
- struct css_id *id = css->id;
- /* When this is called before css_id initialization, id can be NULL */
- if (!id)
- return;
-
- BUG_ON(!ss->use_id);
-
- rcu_assign_pointer(id->css, NULL);
- rcu_assign_pointer(css->id, NULL);
- spin_lock(&ss->id_lock);
- idr_remove(&ss->idr, id->id);
- spin_unlock(&ss->id_lock);
- kfree_rcu(id, rcu_head);
-}
-EXPORT_SYMBOL_GPL(free_css_id);
-
-/*
- * This is called by init or create(). Then, calls to this function are
- * always serialized (By cgroup_mutex() at create()).
- */
-
-static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
-{
- struct css_id *newid;
- int ret, size;
-
- BUG_ON(!ss->use_id);
-
- size = sizeof(*newid) + sizeof(unsigned short) * (depth + 1);
- newid = kzalloc(size, GFP_KERNEL);
- if (!newid)
- return ERR_PTR(-ENOMEM);
-
- idr_preload(GFP_KERNEL);
- spin_lock(&ss->id_lock);
- /* Don't use 0. allocates an ID of 1-65535 */
- ret = idr_alloc(&ss->idr, newid, 1, CSS_ID_MAX + 1, GFP_NOWAIT);
- spin_unlock(&ss->id_lock);
- idr_preload_end();
-
- /* Returns error when there are no free spaces for new ID.*/
- if (ret < 0)
- goto err_out;
-
- newid->id = ret;
- newid->depth = depth;
- return newid;
-err_out:
- kfree(newid);
- return ERR_PTR(ret);
-
-}
-
-static int __init_or_module cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *rootcss)
-{
- struct css_id *newid;
-
- spin_lock_init(&ss->id_lock);
- idr_init(&ss->idr);
-
- newid = get_new_cssid(ss, 0);
- if (IS_ERR(newid))
- return PTR_ERR(newid);
-
- newid->stack[0] = newid->id;
- newid->css = rootcss;
- rootcss->id = newid;
- return 0;
-}
-
-static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
- struct cgroup *child)
-{
- int subsys_id, i, depth = 0;
- struct cgroup_subsys_state *parent_css, *child_css;
- struct css_id *child_id, *parent_id;
-
- subsys_id = ss->subsys_id;
- parent_css = parent->subsys[subsys_id];
- child_css = child->subsys[subsys_id];
- parent_id = parent_css->id;
- depth = parent_id->depth + 1;
-
- child_id = get_new_cssid(ss, depth);
- if (IS_ERR(child_id))
- return PTR_ERR(child_id);
-
- for (i = 0; i < depth; i++)
- child_id->stack[i] = parent_id->stack[i];
- child_id->stack[depth] = child_id->id;
- /*
- * child_id->css pointer will be set after this cgroup is available
- * see cgroup_populate_dir()
- */
- rcu_assign_pointer(child_css->id, child_id);
-
- return 0;
-}
-
-/**
- * css_lookup - lookup css by id
- * @ss: cgroup subsys to be looked into.
- * @id: the id
- *
- * Returns pointer to cgroup_subsys_state if there is valid one with id.
- * NULL if not. Should be called under rcu_read_lock()
- */
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id)
-{
- struct css_id *cssid = NULL;
-
- BUG_ON(!ss->use_id);
- cssid = idr_find(&ss->idr, id);
-
- if (unlikely(!cssid))
- return NULL;
-
- return rcu_dereference(cssid->css);
-}
-EXPORT_SYMBOL_GPL(css_lookup);
-
-/*
* get corresponding css from file open on cgroupfs directory
*/
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 98+ messages in thread* [PATCH 8/8] cgroup: kill css_id
@ 2013-04-08 8:23 ` Li Zefan
0 siblings, 0 replies; 98+ messages in thread
From: Li Zefan @ 2013-04-08 8:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
The only user of css_id was memcg, and it has been converted to
use cgroup->id, so kill css_id.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
include/linux/cgroup.h | 38 --------
kernel/cgroup.c | 258 -------------------------------------------------
2 files changed, 296 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 6ae8ae1..d2c06db 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -495,11 +495,6 @@ struct cgroup_subsys {
int active;
int disabled;
int early_init;
- /*
- * True if this subsys uses ID. ID is not available before cgroup_init()
- * (not available in early_init time.)
- */
- bool use_id;
/*
* If %false, this subsystem is properly hierarchical -
@@ -525,9 +520,6 @@ struct cgroup_subsys {
*/
struct cgroupfs_root *root;
struct list_head sibling;
- /* used when use_id == true */
- struct idr idr;
- spinlock_t id_lock;
/* list of cftype_sets */
struct list_head cftsets;
@@ -699,36 +691,6 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk,
bool threadgroup);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
-/*
- * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
- * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
- * CSS ID is assigned at cgroup allocation (create) automatically
- * and removed when subsys calls free_css_id() function. This is because
- * the lifetime of cgroup_subsys_state is subsys's matter.
- *
- * Looking up and scanning function should be called under rcu_read_lock().
- * Taking cgroup_mutex is not necessary for following calls.
- * But the css returned by this routine can be "not populated yet" or "being
- * destroyed". The caller should check css and cgroup's status.
- */
-
-/*
- * Typically Called at ->destroy(), or somewhere the subsys frees
- * cgroup_subsys_state.
- */
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
-
-/* Find a cgroup_subsys_state which has given ID */
-
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
-
-/* Returns true if root is ancestor of cg */
-bool css_is_ancestor(struct cgroup_subsys_state *cg,
- const struct cgroup_subsys_state *root);
-
-/* Get id and depth of css */
-unsigned short css_id(struct cgroup_subsys_state *css);
-unsigned short css_depth(struct cgroup_subsys_state *css);
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
bool cgroup_is_ancestor(struct cgroup *child, struct cgroup *root);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5ae1e87..2389484 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -165,38 +165,6 @@ struct cfent {
};
/*
- * CSS ID -- ID per subsys's Cgroup Subsys State(CSS). used only when
- * cgroup_subsys->use_id != 0.
- */
-#define CSS_ID_MAX (65535)
-struct css_id {
- /*
- * The css to which this ID points. This pointer is set to valid value
- * after cgroup is populated. If cgroup is removed, this will be NULL.
- * This pointer is expected to be RCU-safe because destroy()
- * is called after synchronize_rcu(). But for safe use, css_tryget()
- * should be used for avoiding race.
- */
- struct cgroup_subsys_state __rcu *css;
- /*
- * ID of this css.
- */
- unsigned short id;
- /*
- * Depth in hierarchy which this ID belongs to.
- */
- unsigned short depth;
- /*
- * ID is freed by RCU. (and lookup routine is RCU safe.)
- */
- struct rcu_head rcu_head;
- /*
- * Hierarchy of CSS ID belongs to.
- */
- unsigned short stack[0]; /* Array of Length (depth+1) */
-};
-
-/*
* cgroup_event represents events which userspace want to receive.
*/
struct cgroup_event {
@@ -363,9 +331,6 @@ struct cg_cgroup_link {
static struct css_set init_css_set;
static struct cg_cgroup_link init_css_set_link;
-static int cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *css);
-
/* css_set_lock protects the list of css_set objects, and the
* chain of tasks off each css_set. Nests outside task->alloc_lock
* due to cgroup_iter_start() */
@@ -843,9 +808,6 @@ static struct backing_dev_info cgroup_backing_dev_info = {
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
};
-static int alloc_css_id(struct cgroup_subsys *ss,
- struct cgroup *parent, struct cgroup *child);
-
static struct inode *cgroup_new_inode(umode_t mode, struct super_block *sb)
{
struct inode *inode = new_inode(sb);
@@ -4002,18 +3964,6 @@ static int cgroup_populate_dir(struct cgroup *cgrp, bool base_files,
cgroup_addrm_files(cgrp, ss, set->cfts, true);
}
- /* This cgroup is ready now */
- for_each_subsys(cgrp->root, ss) {
- struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
- /*
- * Update id->css pointer and make this css visible from
- * CSS ID functions. This pointer will be dereferened
- * from RCU-read-side without locks.
- */
- if (css->id)
- rcu_assign_pointer(css->id->css, css);
- }
-
return 0;
}
@@ -4158,11 +4108,6 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_all;
}
init_cgroup_css(css, ss, cgrp);
- if (ss->use_id) {
- err = alloc_css_id(ss, parent, cgrp);
- if (err)
- goto err_free_all;
- }
}
/*
@@ -4448,12 +4393,6 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* our new subsystem will be attached to the dummy hierarchy. */
init_cgroup_css(css, ss, dummytop);
- /* init_idr must be after init_cgroup_css because it sets css->id. */
- if (ss->use_id) {
- ret = cgroup_init_idr(ss, css);
- if (ret)
- goto err_unload;
- }
/*
* Now we need to entangle the css into the existing css_sets. unlike
@@ -4521,9 +4460,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
offline_css(ss, dummytop);
ss->active = 0;
- if (ss->use_id)
- idr_destroy(&ss->idr);
-
/* deassign the subsys_id */
subsys[ss->subsys_id] = NULL;
@@ -4631,8 +4567,6 @@ int __init cgroup_init(void)
continue;
if (!ss->early_init)
cgroup_init_subsys(ss);
- if (ss->use_id)
- cgroup_init_idr(ss, init_css_set.subsys[ss->subsys_id]);
}
/* Add init_css_set to the hash table */
@@ -5092,198 +5026,6 @@ static int __init cgroup_disable(char *str)
__setup("cgroup_disable=", cgroup_disable);
/*
- * Functons for CSS ID.
- */
-
-/*
- *To get ID other than 0, this should be called when !cgroup_is_removed().
- */
-unsigned short css_id(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- /*
- * This css_id() can return correct value when somone has refcnt
- * on this or this is under rcu_read_lock(). Once css->id is allocated,
- * it's unchanged until freed.
- */
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->id;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_id);
-
-unsigned short css_depth(struct cgroup_subsys_state *css)
-{
- struct css_id *cssid;
-
- cssid = rcu_dereference_check(css->id, css_refcnt(css));
-
- if (cssid)
- return cssid->depth;
- return 0;
-}
-EXPORT_SYMBOL_GPL(css_depth);
-
-/**
- * css_is_ancestor - test "root" css is an ancestor of "child"
- * @child: the css to be tested.
- * @root: the css supporsed to be an ancestor of the child.
- *
- * Returns true if "root" is an ancestor of "child" in its hierarchy. Because
- * this function reads css->id, the caller must hold rcu_read_lock().
- * But, considering usual usage, the csses should be valid objects after test.
- * Assuming that the caller will do some action to the child if this returns
- * returns true, the caller must take "child";s reference count.
- * If "child" is valid object and this returns true, "root" is valid, too.
- */
-
-bool css_is_ancestor(struct cgroup_subsys_state *child,
- const struct cgroup_subsys_state *root)
-{
- struct css_id *child_id;
- struct css_id *root_id;
-
- child_id = rcu_dereference(child->id);
- if (!child_id)
- return false;
- root_id = rcu_dereference(root->id);
- if (!root_id)
- return false;
- if (child_id->depth < root_id->depth)
- return false;
- if (child_id->stack[root_id->depth] != root_id->id)
- return false;
- return true;
-}
-
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css)
-{
- struct css_id *id = css->id;
- /* When this is called before css_id initialization, id can be NULL */
- if (!id)
- return;
-
- BUG_ON(!ss->use_id);
-
- rcu_assign_pointer(id->css, NULL);
- rcu_assign_pointer(css->id, NULL);
- spin_lock(&ss->id_lock);
- idr_remove(&ss->idr, id->id);
- spin_unlock(&ss->id_lock);
- kfree_rcu(id, rcu_head);
-}
-EXPORT_SYMBOL_GPL(free_css_id);
-
-/*
- * This is called by init or create(). Then, calls to this function are
- * always serialized (By cgroup_mutex() at create()).
- */
-
-static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
-{
- struct css_id *newid;
- int ret, size;
-
- BUG_ON(!ss->use_id);
-
- size = sizeof(*newid) + sizeof(unsigned short) * (depth + 1);
- newid = kzalloc(size, GFP_KERNEL);
- if (!newid)
- return ERR_PTR(-ENOMEM);
-
- idr_preload(GFP_KERNEL);
- spin_lock(&ss->id_lock);
- /* Don't use 0. allocates an ID of 1-65535 */
- ret = idr_alloc(&ss->idr, newid, 1, CSS_ID_MAX + 1, GFP_NOWAIT);
- spin_unlock(&ss->id_lock);
- idr_preload_end();
-
- /* Returns error when there are no free spaces for new ID.*/
- if (ret < 0)
- goto err_out;
-
- newid->id = ret;
- newid->depth = depth;
- return newid;
-err_out:
- kfree(newid);
- return ERR_PTR(ret);
-
-}
-
-static int __init_or_module cgroup_init_idr(struct cgroup_subsys *ss,
- struct cgroup_subsys_state *rootcss)
-{
- struct css_id *newid;
-
- spin_lock_init(&ss->id_lock);
- idr_init(&ss->idr);
-
- newid = get_new_cssid(ss, 0);
- if (IS_ERR(newid))
- return PTR_ERR(newid);
-
- newid->stack[0] = newid->id;
- newid->css = rootcss;
- rootcss->id = newid;
- return 0;
-}
-
-static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
- struct cgroup *child)
-{
- int subsys_id, i, depth = 0;
- struct cgroup_subsys_state *parent_css, *child_css;
- struct css_id *child_id, *parent_id;
-
- subsys_id = ss->subsys_id;
- parent_css = parent->subsys[subsys_id];
- child_css = child->subsys[subsys_id];
- parent_id = parent_css->id;
- depth = parent_id->depth + 1;
-
- child_id = get_new_cssid(ss, depth);
- if (IS_ERR(child_id))
- return PTR_ERR(child_id);
-
- for (i = 0; i < depth; i++)
- child_id->stack[i] = parent_id->stack[i];
- child_id->stack[depth] = child_id->id;
- /*
- * child_id->css pointer will be set after this cgroup is available
- * see cgroup_populate_dir()
- */
- rcu_assign_pointer(child_css->id, child_id);
-
- return 0;
-}
-
-/**
- * css_lookup - lookup css by id
- * @ss: cgroup subsys to be looked into.
- * @id: the id
- *
- * Returns pointer to cgroup_subsys_state if there is valid one with id.
- * NULL if not. Should be called under rcu_read_lock()
- */
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id)
-{
- struct css_id *cssid = NULL;
-
- BUG_ON(!ss->use_id);
- cssid = idr_find(&ss->idr, id);
-
- if (unlikely(!cssid))
- return NULL;
-
- return rcu_dereference(cssid->css);
-}
-EXPORT_SYMBOL_GPL(css_lookup);
-
-/*
* get corresponding css from file open on cgroupfs directory
*/
struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id)
--
1.8.0.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 98+ messages in thread* Re: [PATCH 8/8] cgroup: kill css_id
2013-04-08 8:23 ` Li Zefan
@ 2013-04-08 15:51 ` Tejun Heo
-1 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:51 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon, Apr 08, 2013 at 04:23:42PM +0800, Li Zefan wrote:
> The only user of css_id was memcg, and it has been converted to
> use cgroup->id, so kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Violently-acked-by: Tejun Heo <tj@kernel.org>
Thanks a lot for killing this abomination.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 8/8] cgroup: kill css_id
@ 2013-04-08 15:51 ` Tejun Heo
0 siblings, 0 replies; 98+ messages in thread
From: Tejun Heo @ 2013-04-08 15:51 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Glauber Costa, KAMEZAWA Hiroyuki, Michal Hocko,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon, Apr 08, 2013 at 04:23:42PM +0800, Li Zefan wrote:
> The only user of css_id was memcg, and it has been converted to
> use cgroup->id, so kill css_id.
>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Violently-acked-by: Tejun Heo <tj@kernel.org>
Thanks a lot for killing this abomination.
--
tejun
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 0/8] memcg, cgroup: kill css_id
2013-04-08 8:19 ` Li Zefan
(?)
@ 2013-04-08 14:37 ` Michal Hocko
-1 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:37 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg
On Mon 08-04-13 16:19:53, Li Zefan wrote:
[...]
> include/linux/cgroup.h | 44 ++-------
> kernel/cgroup.c | 302 +++++++++-----------------------------------------------------
> mm/memcontrol.c | 53 ++++++-----
> 3 files changed, 77 insertions(+), 322 deletions(-)
Nice and thanks a lot Li!
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 0/8] memcg, cgroup: kill css_id
@ 2013-04-08 14:37 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:37 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:19:53, Li Zefan wrote:
[...]
> include/linux/cgroup.h | 44 ++-------
> kernel/cgroup.c | 302 +++++++++-----------------------------------------------------
> mm/memcontrol.c | 53 ++++++-----
> 3 files changed, 77 insertions(+), 322 deletions(-)
Nice and thanks a lot Li!
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 98+ messages in thread
* Re: [PATCH 0/8] memcg, cgroup: kill css_id
@ 2013-04-08 14:37 ` Michal Hocko
0 siblings, 0 replies; 98+ messages in thread
From: Michal Hocko @ 2013-04-08 14:37 UTC (permalink / raw)
To: Li Zefan
Cc: Andrew Morton, Tejun Heo, Glauber Costa, KAMEZAWA Hiroyuki,
Johannes Weiner, LKML, Cgroups, linux-mm
On Mon 08-04-13 16:19:53, Li Zefan wrote:
[...]
> include/linux/cgroup.h | 44 ++-------
> kernel/cgroup.c | 302 +++++++++-----------------------------------------------------
> mm/memcontrol.c | 53 ++++++-----
> 3 files changed, 77 insertions(+), 322 deletions(-)
Nice and thanks a lot Li!
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 98+ messages in thread