Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup->children

2012-11-09 Thread Li Zefan
On 2012/11/3 16:38, Tejun Heo wrote:
> Use RCU safe list operations for cgroup->children.  This will be used
> to implement cgroup children / descendant walking which can be used by
> controllers.
> 
> Note that cgroup_create() now puts a new cgroup at the end of the
> ->children list instead of head.  This isn't strictly necessary but is
> done so that the iteration order is more conventional.
> 
> Signed-off-by: Tejun Heo 

Acked-by: Li Zefan 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup-children

2012-11-09 Thread Li Zefan
On 2012/11/3 16:38, Tejun Heo wrote:
 Use RCU safe list operations for cgroup-children.  This will be used
 to implement cgroup children / descendant walking which can be used by
 controllers.
 
 Note that cgroup_create() now puts a new cgroup at the end of the
 -children list instead of head.  This isn't strictly necessary but is
 done so that the iteration order is more conventional.
 
 Signed-off-by: Tejun Heo t...@kernel.org

Acked-by: Li Zefan lize...@huawei.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup->children

2012-11-07 Thread Kamezawa Hiroyuki

(2012/11/03 17:38), Tejun Heo wrote:

Use RCU safe list operations for cgroup->children.  This will be used
to implement cgroup children / descendant walking which can be used by
controllers.

Note that cgroup_create() now puts a new cgroup at the end of the
->children list instead of head.  This isn't strictly necessary but is
done so that the iteration order is more conventional.

Signed-off-by: Tejun Heo 


Reviewed-by: KAMEZAWA Hiroyuki 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup->children

2012-11-07 Thread Michal Hocko
On Sat 03-11-12 01:38:28, Tejun Heo wrote:
> Use RCU safe list operations for cgroup->children.  This will be used
> to implement cgroup children / descendant walking which can be used by
> controllers.
> 
> Note that cgroup_create() now puts a new cgroup at the end of the
> ->children list instead of head.  This isn't strictly necessary but is
> done so that the iteration order is more conventional.
> 
> Signed-off-by: Tejun Heo 

Reviewed-by: Michal Hocko 

> ---
>  include/linux/cgroup.h | 1 +
>  kernel/cgroup.c| 8 +++-
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index b442122..90c33eb 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index f05d992..cc5d2a0 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1650,7 +1650,6 @@ static struct dentry *cgroup_mount(struct 
> file_system_type *fs_type,
>  
>   free_cg_links(_cg_links);
>  
> - BUG_ON(!list_empty(_cgrp->sibling));
>   BUG_ON(!list_empty(_cgrp->children));
>   BUG_ON(root->number_of_cgroups != 1);
>  
> @@ -1699,7 +1698,6 @@ static void cgroup_kill_sb(struct super_block *sb) {
>  
>   BUG_ON(root->number_of_cgroups != 1);
>   BUG_ON(!list_empty(>children));
> - BUG_ON(!list_empty(>sibling));
>  
>   mutex_lock(_mutex);
>   mutex_lock(_root_mutex);
> @@ -4053,7 +4051,7 @@ static long cgroup_create(struct cgroup *parent, struct 
> dentry *dentry,
>   }
>   }
>  
> - list_add(>sibling, >parent->children);
> + list_add_tail_rcu(>sibling, >parent->children);
>   root->number_of_cgroups++;
>  
>   err = cgroup_create_dir(cgrp, dentry, mode);
> @@ -4084,7 +4082,7 @@ static long cgroup_create(struct cgroup *parent, struct 
> dentry *dentry,
>  
>   err_remove:
>  
> - list_del(>sibling);
> + list_del_rcu(>sibling);
>   root->number_of_cgroups--;
>  
>   err_destroy:
> @@ -4210,7 +4208,7 @@ static int cgroup_rmdir(struct inode *unused_dir, 
> struct dentry *dentry)
>   raw_spin_unlock(_list_lock);
>  
>   /* delete this cgroup from parent->children */
> - list_del_init(>sibling);
> + list_del_rcu(>sibling);
>  
>   list_del_init(>allcg_node);
>  
> -- 
> 1.7.11.7
> 

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup-children

2012-11-07 Thread Michal Hocko
On Sat 03-11-12 01:38:28, Tejun Heo wrote:
 Use RCU safe list operations for cgroup-children.  This will be used
 to implement cgroup children / descendant walking which can be used by
 controllers.
 
 Note that cgroup_create() now puts a new cgroup at the end of the
 -children list instead of head.  This isn't strictly necessary but is
 done so that the iteration order is more conventional.
 
 Signed-off-by: Tejun Heo t...@kernel.org

Reviewed-by: Michal Hocko mho...@suse.cz

 ---
  include/linux/cgroup.h | 1 +
  kernel/cgroup.c| 8 +++-
  2 files changed, 4 insertions(+), 5 deletions(-)
 
 diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
 index b442122..90c33eb 100644
 --- a/include/linux/cgroup.h
 +++ b/include/linux/cgroup.h
 @@ -12,6 +12,7 @@
  #include linux/cpumask.h
  #include linux/nodemask.h
  #include linux/rcupdate.h
 +#include linux/rculist.h
  #include linux/cgroupstats.h
  #include linux/prio_heap.h
  #include linux/rwsem.h
 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
 index f05d992..cc5d2a0 100644
 --- a/kernel/cgroup.c
 +++ b/kernel/cgroup.c
 @@ -1650,7 +1650,6 @@ static struct dentry *cgroup_mount(struct 
 file_system_type *fs_type,
  
   free_cg_links(tmp_cg_links);
  
 - BUG_ON(!list_empty(root_cgrp-sibling));
   BUG_ON(!list_empty(root_cgrp-children));
   BUG_ON(root-number_of_cgroups != 1);
  
 @@ -1699,7 +1698,6 @@ static void cgroup_kill_sb(struct super_block *sb) {
  
   BUG_ON(root-number_of_cgroups != 1);
   BUG_ON(!list_empty(cgrp-children));
 - BUG_ON(!list_empty(cgrp-sibling));
  
   mutex_lock(cgroup_mutex);
   mutex_lock(cgroup_root_mutex);
 @@ -4053,7 +4051,7 @@ static long cgroup_create(struct cgroup *parent, struct 
 dentry *dentry,
   }
   }
  
 - list_add(cgrp-sibling, cgrp-parent-children);
 + list_add_tail_rcu(cgrp-sibling, cgrp-parent-children);
   root-number_of_cgroups++;
  
   err = cgroup_create_dir(cgrp, dentry, mode);
 @@ -4084,7 +4082,7 @@ static long cgroup_create(struct cgroup *parent, struct 
 dentry *dentry,
  
   err_remove:
  
 - list_del(cgrp-sibling);
 + list_del_rcu(cgrp-sibling);
   root-number_of_cgroups--;
  
   err_destroy:
 @@ -4210,7 +4208,7 @@ static int cgroup_rmdir(struct inode *unused_dir, 
 struct dentry *dentry)
   raw_spin_unlock(release_list_lock);
  
   /* delete this cgroup from parent-children */
 - list_del_init(cgrp-sibling);
 + list_del_rcu(cgrp-sibling);
  
   list_del_init(cgrp-allcg_node);
  
 -- 
 1.7.11.7
 

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/9] cgroup: Use rculist ops for cgroup-children

2012-11-07 Thread Kamezawa Hiroyuki

(2012/11/03 17:38), Tejun Heo wrote:

Use RCU safe list operations for cgroup-children.  This will be used
to implement cgroup children / descendant walking which can be used by
controllers.

Note that cgroup_create() now puts a new cgroup at the end of the
-children list instead of head.  This isn't strictly necessary but is
done so that the iteration order is more conventional.

Signed-off-by: Tejun Heo t...@kernel.org


Reviewed-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/9] cgroup: Use rculist ops for cgroup->children

2012-11-03 Thread Tejun Heo
Use RCU safe list operations for cgroup->children.  This will be used
to implement cgroup children / descendant walking which can be used by
controllers.

Note that cgroup_create() now puts a new cgroup at the end of the
->children list instead of head.  This isn't strictly necessary but is
done so that the iteration order is more conventional.

Signed-off-by: Tejun Heo 
---
 include/linux/cgroup.h | 1 +
 kernel/cgroup.c| 8 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b442122..90c33eb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f05d992..cc5d2a0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1650,7 +1650,6 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
 
free_cg_links(_cg_links);
 
-   BUG_ON(!list_empty(_cgrp->sibling));
BUG_ON(!list_empty(_cgrp->children));
BUG_ON(root->number_of_cgroups != 1);
 
@@ -1699,7 +1698,6 @@ static void cgroup_kill_sb(struct super_block *sb) {
 
BUG_ON(root->number_of_cgroups != 1);
BUG_ON(!list_empty(>children));
-   BUG_ON(!list_empty(>sibling));
 
mutex_lock(_mutex);
mutex_lock(_root_mutex);
@@ -4053,7 +4051,7 @@ static long cgroup_create(struct cgroup *parent, struct 
dentry *dentry,
}
}
 
-   list_add(>sibling, >parent->children);
+   list_add_tail_rcu(>sibling, >parent->children);
root->number_of_cgroups++;
 
err = cgroup_create_dir(cgrp, dentry, mode);
@@ -4084,7 +4082,7 @@ static long cgroup_create(struct cgroup *parent, struct 
dentry *dentry,
 
  err_remove:
 
-   list_del(>sibling);
+   list_del_rcu(>sibling);
root->number_of_cgroups--;
 
  err_destroy:
@@ -4210,7 +4208,7 @@ static int cgroup_rmdir(struct inode *unused_dir, struct 
dentry *dentry)
raw_spin_unlock(_list_lock);
 
/* delete this cgroup from parent->children */
-   list_del_init(>sibling);
+   list_del_rcu(>sibling);
 
list_del_init(>allcg_node);
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/9] cgroup: Use rculist ops for cgroup-children

2012-11-03 Thread Tejun Heo
Use RCU safe list operations for cgroup-children.  This will be used
to implement cgroup children / descendant walking which can be used by
controllers.

Note that cgroup_create() now puts a new cgroup at the end of the
-children list instead of head.  This isn't strictly necessary but is
done so that the iteration order is more conventional.

Signed-off-by: Tejun Heo t...@kernel.org
---
 include/linux/cgroup.h | 1 +
 kernel/cgroup.c| 8 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b442122..90c33eb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -12,6 +12,7 @@
 #include linux/cpumask.h
 #include linux/nodemask.h
 #include linux/rcupdate.h
+#include linux/rculist.h
 #include linux/cgroupstats.h
 #include linux/prio_heap.h
 #include linux/rwsem.h
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f05d992..cc5d2a0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1650,7 +1650,6 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
 
free_cg_links(tmp_cg_links);
 
-   BUG_ON(!list_empty(root_cgrp-sibling));
BUG_ON(!list_empty(root_cgrp-children));
BUG_ON(root-number_of_cgroups != 1);
 
@@ -1699,7 +1698,6 @@ static void cgroup_kill_sb(struct super_block *sb) {
 
BUG_ON(root-number_of_cgroups != 1);
BUG_ON(!list_empty(cgrp-children));
-   BUG_ON(!list_empty(cgrp-sibling));
 
mutex_lock(cgroup_mutex);
mutex_lock(cgroup_root_mutex);
@@ -4053,7 +4051,7 @@ static long cgroup_create(struct cgroup *parent, struct 
dentry *dentry,
}
}
 
-   list_add(cgrp-sibling, cgrp-parent-children);
+   list_add_tail_rcu(cgrp-sibling, cgrp-parent-children);
root-number_of_cgroups++;
 
err = cgroup_create_dir(cgrp, dentry, mode);
@@ -4084,7 +4082,7 @@ static long cgroup_create(struct cgroup *parent, struct 
dentry *dentry,
 
  err_remove:
 
-   list_del(cgrp-sibling);
+   list_del_rcu(cgrp-sibling);
root-number_of_cgroups--;
 
  err_destroy:
@@ -4210,7 +4208,7 @@ static int cgroup_rmdir(struct inode *unused_dir, struct 
dentry *dentry)
raw_spin_unlock(release_list_lock);
 
/* delete this cgroup from parent-children */
-   list_del_init(cgrp-sibling);
+   list_del_rcu(cgrp-sibling);
 
list_del_init(cgrp-allcg_node);
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/