linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] blk-cgroup: Allow creation of hierarchical cgroups
@ 2010-11-02 22:20 Vivek Goyal
  2010-11-03  0:11 ` Chad Talbott
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Vivek Goyal @ 2010-11-02 22:20 UTC (permalink / raw)
  To: Jens Axboe, linux kernel mailing list
  Cc: Gui Jianfeng, Balbir Singh, KAMEZAWA Hiroyuki, Li Zefan,
	Nauman Rafique, Daniel P. Berrange

o Allow hierarchical cgroup creation for blkio controller

o Currently we disallow it as both the io controller policies (throttling
  as well as proportion bandwidth) do not support hierarhical accounting
  and control. But the flip side is that blkio controller can not be used with
  libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.

  <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>

o So this patch will allow creation of cgroup hierarhcy but at the backend
  everything will be treated as flat. So if somebody created a an hierarchy
  like as follows.

			root	
			/  \
		     test1 test2
			|
		     test3

  CFQ and throttling will practically treat all groups at same level.
			
				pivot
			     /  |   \  \
			root  test1 test2  test3

o Once we have actual support for hierarchical accounting and control
  then we can introduce another cgroup tunable file "blkio.use_hierarchy"
  which will be 0 by default but if user wants to enforce hierarhical
  control then it can be set to 1. This way there should not be any
  ABI problems down the line.

o The only not so pretty part is introduction of extra file "use_hierarchy"
  down the line. Kame-san had mentioned that hierarhical accounting is
  expensive in memory controller hence they keep it off by default. I
  suspect same will be the case for IO controller also as for each IO
  completion we shall have to account IO through hierarchy up to the root.
  if yes, then it probably is not a very bad idea to introduce this extra
  file so that it will be used only when somebody needs it and some people
  might enable hierarchy only in part of the hierarchy. 

o This is how basically memory controller also uses "use_hierarhcy" and
  they also allowed creation of hierarchies when actual backend support
  was not available.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 Documentation/cgroups/blkio-controller.txt |   27 +++++++++++++++++++++++++++
 block/blk-cgroup.c                         |    4 ----
 2 files changed, 27 insertions(+), 4 deletions(-)

Index: linux-2.6/block/blk-cgroup.c
===================================================================
--- linux-2.6.orig/block/blk-cgroup.c	2010-10-28 14:19:02.000000000 -0400
+++ linux-2.6/block/blk-cgroup.c	2010-11-02 13:10:13.000000000 -0400
@@ -1452,10 +1452,6 @@ blkiocg_create(struct cgroup_subsys *sub
 		goto done;
 	}
 
-	/* Currently we do not support hierarchy deeper than two level (0,1) */
-	if (parent != cgroup->top_cgroup)
-		return ERR_PTR(-EPERM);
-
 	blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
 	if (!blkcg)
 		return ERR_PTR(-ENOMEM);
Index: linux-2.6/Documentation/cgroups/blkio-controller.txt
===================================================================
--- linux-2.6.orig/Documentation/cgroups/blkio-controller.txt	2010-10-28 14:19:01.000000000 -0400
+++ linux-2.6/Documentation/cgroups/blkio-controller.txt	2010-11-02 17:51:52.000000000 -0400
@@ -89,6 +89,33 @@ Throttling/Upper Limit policy
 
  Limits for writes can be put using blkio.write_bps_device file.
 
+Hierarchical Cgroups
+====================
+- Currently none of the IO control policy supports hierarhical groups. But
+  cgroup interface does allow creation of hierarhical cgroups and internally
+  IO policies treat them as flat hierarchy.
+
+  So this patch will allow creation of cgroup hierarhcy but at the backend
+  everything will be treated as flat. So if somebody created a hierarchy like
+  as follows.
+
+			root
+			/  \
+		     test1 test2
+			|
+		     test3
+
+  CFQ and throttling will practically treat all groups at same level.
+
+				pivot
+			     /  |   \  \
+			root  test1 test2  test3
+
+  Down the line we can implement hierarchical accounting/control support
+  and also introduce a new cgroup file "use_hierarchy" which will control
+  whether cgroup hierarchy is viewed as flat or hierarchical by the policy.
+  This is how memory controller also has implemented the things.
+
 Various user visible config options
 ===================================
 CONFIG_BLK_CGROUP

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
@ 2010-11-03  0:11 ` Chad Talbott
  2010-11-03 13:26   ` Vivek Goyal
  2010-11-03  2:27 ` Balbir Singh
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Chad Talbott @ 2010-11-03  0:11 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Jens Axboe, linux kernel mailing list, Gui Jianfeng,
	Balbir Singh, KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique,
	Daniel P. Berrange

On Tue, Nov 2, 2010 at 3:20 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> o Allow hierarchical cgroup creation for blkio controller

Vivek,

This patch looks fine, and we use similar code.  I'd be even more
interested in directing effort at Gui's patchset that fully implements
hierarchy.  If there are specific details that are blocking adoption
of that code, let's address them.

Chad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
  2010-11-03  0:11 ` Chad Talbott
@ 2010-11-03  2:27 ` Balbir Singh
  2010-11-03  4:14 ` Gui Jianfeng
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Balbir Singh @ 2010-11-03  2:27 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Jens Axboe, linux kernel mailing list, Gui Jianfeng,
	KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique, Daniel P. Berrange

* Vivek Goyal <vgoyal@redhat.com> [2010-11-02 18:20:30]:

> o Allow hierarchical cgroup creation for blkio controller
> 
> o Currently we disallow it as both the io controller policies (throttling
>   as well as proportion bandwidth) do not support hierarhical accounting
>   and control. But the flip side is that blkio controller can not be used with
>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
> 
>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
> 
> o So this patch will allow creation of cgroup hierarhcy but at the backend
>   everything will be treated as flat. So if somebody created a an hierarchy
>   like as follows.
> 
> 			root	
> 			/  \
> 		     test1 test2
> 			|
> 		     test3
> 
>   CFQ and throttling will practically treat all groups at same level.
> 			
> 				pivot
> 			     /  |   \  \
> 			root  test1 test2  test3
> 
> o Once we have actual support for hierarchical accounting and control
>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>   which will be 0 by default but if user wants to enforce hierarhical
>   control then it can be set to 1. This way there should not be any
>   ABI problems down the line.
> 
> o The only not so pretty part is introduction of extra file "use_hierarchy"
>   down the line. Kame-san had mentioned that hierarhical accounting is
>   expensive in memory controller hence they keep it off by default. I
>   suspect same will be the case for IO controller also as for each IO
>   completion we shall have to account IO through hierarchy up to the root.
>   if yes, then it probably is not a very bad idea to introduce this extra
>   file so that it will be used only when somebody needs it and some people
>   might enable hierarchy only in part of the hierarchy. 
> 
> o This is how basically memory controller also uses "use_hierarhcy" and
>   they also allowed creation of hierarchies when actual backend support
>   was not available.
> 
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>


Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
 

-- 
	Three Cheers,
	Balbir

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
  2010-11-03  0:11 ` Chad Talbott
  2010-11-03  2:27 ` Balbir Singh
@ 2010-11-03  4:14 ` Gui Jianfeng
  2010-11-03 15:03 ` Ciju Rajan K
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gui Jianfeng @ 2010-11-03  4:14 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Jens Axboe, linux kernel mailing list, Balbir Singh,
	KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique, Daniel P. Berrange

Vivek Goyal wrote:
> o Allow hierarchical cgroup creation for blkio controller
> 
> o Currently we disallow it as both the io controller policies (throttling
>   as well as proportion bandwidth) do not support hierarhical accounting
>   and control. But the flip side is that blkio controller can not be used with
>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
> 
>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
> 
> o So this patch will allow creation of cgroup hierarhcy but at the backend
>   everything will be treated as flat. So if somebody created a an hierarchy
>   like as follows.
> 
> 			root	
> 			/  \
> 		     test1 test2
> 			|
> 		     test3
> 
>   CFQ and throttling will practically treat all groups at same level.
> 			
> 				pivot
> 			     /  |   \  \
> 			root  test1 test2  test3
> 
> o Once we have actual support for hierarchical accounting and control
>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>   which will be 0 by default but if user wants to enforce hierarhical
>   control then it can be set to 1. This way there should not be any
>   ABI problems down the line.
> 
> o The only not so pretty part is introduction of extra file "use_hierarchy"
>   down the line. Kame-san had mentioned that hierarhical accounting is
>   expensive in memory controller hence they keep it off by default. I
>   suspect same will be the case for IO controller also as for each IO
>   completion we shall have to account IO through hierarchy up to the root.
>   if yes, then it probably is not a very bad idea to introduce this extra
>   file so that it will be used only when somebody needs it and some people
>   might enable hierarchy only in part of the hierarchy. 
> 
> o This is how basically memory controller also uses "use_hierarhcy" and
>   they also allowed creation of hierarchies when actual backend support
>   was not available.
> 
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>

Hi Vivek,

This patch looks good to me.

Reviewed-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>

> ---
>  Documentation/cgroups/blkio-controller.txt |   27 +++++++++++++++++++++++++++
>  block/blk-cgroup.c                         |    4 ----
>  2 files changed, 27 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/block/blk-cgroup.c
> ===================================================================
> --- linux-2.6.orig/block/blk-cgroup.c	2010-10-28 14:19:02.000000000 -0400
> +++ linux-2.6/block/blk-cgroup.c	2010-11-02 13:10:13.000000000 -0400
> @@ -1452,10 +1452,6 @@ blkiocg_create(struct cgroup_subsys *sub
>  		goto done;
>  	}
>  
> -	/* Currently we do not support hierarchy deeper than two level (0,1) */
> -	if (parent != cgroup->top_cgroup)
> -		return ERR_PTR(-EPERM);
> -
>  	blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
>  	if (!blkcg)
>  		return ERR_PTR(-ENOMEM);
> Index: linux-2.6/Documentation/cgroups/blkio-controller.txt
> ===================================================================
> --- linux-2.6.orig/Documentation/cgroups/blkio-controller.txt	2010-10-28 14:19:01.000000000 -0400
> +++ linux-2.6/Documentation/cgroups/blkio-controller.txt	2010-11-02 17:51:52.000000000 -0400
> @@ -89,6 +89,33 @@ Throttling/Upper Limit policy
>  
>   Limits for writes can be put using blkio.write_bps_device file.
>  
> +Hierarchical Cgroups
> +====================
> +- Currently none of the IO control policy supports hierarhical groups. But
> +  cgroup interface does allow creation of hierarhical cgroups and internally
> +  IO policies treat them as flat hierarchy.
> +
> +  So this patch will allow creation of cgroup hierarhcy but at the backend
> +  everything will be treated as flat. So if somebody created a hierarchy like
> +  as follows.
> +
> +			root
> +			/  \
> +		     test1 test2
> +			|
> +		     test3
> +
> +  CFQ and throttling will practically treat all groups at same level.
> +
> +				pivot
> +			     /  |   \  \
> +			root  test1 test2  test3
> +
> +  Down the line we can implement hierarchical accounting/control support
> +  and also introduce a new cgroup file "use_hierarchy" which will control
> +  whether cgroup hierarchy is viewed as flat or hierarchical by the policy.
> +  This is how memory controller also has implemented the things.
> +
>  Various user visible config options
>  ===================================
>  CONFIG_BLK_CGROUP
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-03  0:11 ` Chad Talbott
@ 2010-11-03 13:26   ` Vivek Goyal
  0 siblings, 0 replies; 9+ messages in thread
From: Vivek Goyal @ 2010-11-03 13:26 UTC (permalink / raw)
  To: Chad Talbott
  Cc: Jens Axboe, linux kernel mailing list, Gui Jianfeng,
	Balbir Singh, KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique,
	Daniel P. Berrange

On Tue, Nov 02, 2010 at 05:11:24PM -0700, Chad Talbott wrote:
> On Tue, Nov 2, 2010 at 3:20 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> > o Allow hierarchical cgroup creation for blkio controller
> 
> Vivek,
> 
> This patch looks fine, and we use similar code.  I'd be even more
> interested in directing effort at Gui's patchset that fully implements
> hierarchy.  If there are specific details that are blocking adoption
> of that code, let's address them.

Hi Chad,

My primary concern was re-organizing the code in such a way so that we
treat queues and groups at the same level. I think Gui is now addressing
those concerns.

I have detailed my concerns in this thread. (You are CCed though in the
thread).

http://lkml.org/lkml/2010/8/30/30

Thanks
Vivek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
                   ` (2 preceding siblings ...)
  2010-11-03  4:14 ` Gui Jianfeng
@ 2010-11-03 15:03 ` Ciju Rajan K
  2010-11-15 15:28 ` Vivek Goyal
  2010-11-16  2:50 ` KAMEZAWA Hiroyuki
  5 siblings, 0 replies; 9+ messages in thread
From: Ciju Rajan K @ 2010-11-03 15:03 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Jens Axboe, linux kernel mailing list, Gui Jianfeng,
	Balbir Singh, KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique,
	Daniel P. Berrange

Vivek Goyal wrote:
> o Allow hierarchical cgroup creation for blkio controller
>
> o Currently we disallow it as both the io controller policies (throttling
>   as well as proportion bandwidth) do not support hierarhical accounting
>   and control. But the flip side is that blkio controller can not be used with
>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
>
>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
>
> o So this patch will allow creation of cgroup hierarhcy but at the backend
>   everything will be treated as flat. So if somebody created a an hierarchy
>   like as follows.
>
> 			root	
> 			/  \
> 		     test1 test2
> 			|
> 		     test3
>
>   CFQ and throttling will practically treat all groups at same level.
> 			
> 				pivot
> 			     /  |   \  \
> 			root  test1 test2  test3
>
> o Once we have actual support for hierarchical accounting and control
>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>   which will be 0 by default but if user wants to enforce hierarhical
>   control then it can be set to 1. This way there should not be any
>   ABI problems down the line.
>
> o The only not so pretty part is introduction of extra file "use_hierarchy"
>   down the line. Kame-san had mentioned that hierarhical accounting is
>   expensive in memory controller hence they keep it off by default. I
>   suspect same will be the case for IO controller also as for each IO
>   completion we shall have to account IO through hierarchy up to the root.
>   if yes, then it probably is not a very bad idea to introduce this extra
>   file so that it will be used only when somebody needs it and some people
>   might enable hierarchy only in part of the hierarchy. 
>
> o This is how basically memory controller also uses "use_hierarhcy" and
>   they also allowed creation of hierarchies when actual backend support
>   was not available.
>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  Documentation/cgroups/blkio-controller.txt |   27 +++++++++++++++++++++++++++
>  block/blk-cgroup.c                         |    4 ----
>  2 files changed, 27 insertions(+), 4 deletions(-)
>
> Index: linux-2.6/block/blk-cgroup.c
> ===================================================================
> --- linux-2.6.orig/block/blk-cgroup.c	2010-10-28 14:19:02.000000000 -0400
> +++ linux-2.6/block/blk-cgroup.c	2010-11-02 13:10:13.000000000 -0400
> @@ -1452,10 +1452,6 @@ blkiocg_create(struct cgroup_subsys *sub
>  		goto done;
>  	}
>
> -	/* Currently we do not support hierarchy deeper than two level (0,1) */
> -	if (parent != cgroup->top_cgroup)
> -		return ERR_PTR(-EPERM);
> -
>  	blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
>  	if (!blkcg)
>  		return ERR_PTR(-ENOMEM);
> Index: linux-2.6/Documentation/cgroups/blkio-controller.txt
> ===================================================================
> --- linux-2.6.orig/Documentation/cgroups/blkio-controller.txt	2010-10-28 14:19:01.000000000 -0400
> +++ linux-2.6/Documentation/cgroups/blkio-controller.txt	2010-11-02 17:51:52.000000000 -0400
> @@ -89,6 +89,33 @@ Throttling/Upper Limit policy
>
>   Limits for writes can be put using blkio.write_bps_device file.
>
> +Hierarchical Cgroups
> +====================
> +- Currently none of the IO control policy supports hierarhical groups. But
> +  cgroup interface does allow creation of hierarhical cgroups and internally
> +  IO policies treat them as flat hierarchy.
> +
> +  So this patch will allow creation of cgroup hierarhcy but at the backend
> +  everything will be treated as flat. So if somebody created a hierarchy like
> +  as follows.
> +
> +			root
> +			/  \
> +		     test1 test2
> +			|
> +		     test3
> +
> +  CFQ and throttling will practically treat all groups at same level.
> +
> +				pivot
> +			     /  |   \  \
> +			root  test1 test2  test3
> +
> +  Down the line we can implement hierarchical accounting/control support
> +  and also introduce a new cgroup file "use_hierarchy" which will control
> +  whether cgroup hierarchy is viewed as flat or hierarchical by the policy.
> +  This is how memory controller also has implemented the things.
> +
>  Various user visible config options
>  ===================================
>  CONFIG_BLK_CGROUP
>   
Reviewed-by: Ciju Rajan K <ciju@linux.vnet.ibm.com>
Tested-by: Ciju Rajan K <ciju@linux.vnet.ibm.com>
> --
> 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/
>
>   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
                   ` (3 preceding siblings ...)
  2010-11-03 15:03 ` Ciju Rajan K
@ 2010-11-15 15:28 ` Vivek Goyal
  2010-11-15 18:38   ` Jens Axboe
  2010-11-16  2:50 ` KAMEZAWA Hiroyuki
  5 siblings, 1 reply; 9+ messages in thread
From: Vivek Goyal @ 2010-11-15 15:28 UTC (permalink / raw)
  To: Jens Axboe, linux kernel mailing list
  Cc: Gui Jianfeng, Balbir Singh, KAMEZAWA Hiroyuki, Li Zefan,
	Nauman Rafique, Daniel P. Berrange

On Tue, Nov 02, 2010 at 06:20:30PM -0400, Vivek Goyal wrote:
> o Allow hierarchical cgroup creation for blkio controller
> 
> o Currently we disallow it as both the io controller policies (throttling
>   as well as proportion bandwidth) do not support hierarhical accounting
>   and control. But the flip side is that blkio controller can not be used with
>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
> 
>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
> 
> o So this patch will allow creation of cgroup hierarhcy but at the backend
>   everything will be treated as flat. So if somebody created a an hierarchy
>   like as follows.
> 
> 			root	
> 			/  \
> 		     test1 test2
> 			|
> 		     test3
> 
>   CFQ and throttling will practically treat all groups at same level.
> 			
> 				pivot
> 			     /  |   \  \
> 			root  test1 test2  test3
> 
> o Once we have actual support for hierarchical accounting and control
>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>   which will be 0 by default but if user wants to enforce hierarhical
>   control then it can be set to 1. This way there should not be any
>   ABI problems down the line.
> 
> o The only not so pretty part is introduction of extra file "use_hierarchy"
>   down the line. Kame-san had mentioned that hierarhical accounting is
>   expensive in memory controller hence they keep it off by default. I
>   suspect same will be the case for IO controller also as for each IO
>   completion we shall have to account IO through hierarchy up to the root.
>   if yes, then it probably is not a very bad idea to introduce this extra
>   file so that it will be used only when somebody needs it and some people
>   might enable hierarchy only in part of the hierarchy. 
> 
> o This is how basically memory controller also uses "use_hierarhcy" and
>   they also allowed creation of hierarchies when actual backend support
>   was not available.
> 
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---

Hi Jens,

Do you have any concerns about this patch? If not, can you please apply
it.

Thanks
Vivek

>  Documentation/cgroups/blkio-controller.txt |   27 +++++++++++++++++++++++++++
>  block/blk-cgroup.c                         |    4 ----
>  2 files changed, 27 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/block/blk-cgroup.c
> ===================================================================
> --- linux-2.6.orig/block/blk-cgroup.c	2010-10-28 14:19:02.000000000 -0400
> +++ linux-2.6/block/blk-cgroup.c	2010-11-02 13:10:13.000000000 -0400
> @@ -1452,10 +1452,6 @@ blkiocg_create(struct cgroup_subsys *sub
>  		goto done;
>  	}
>  
> -	/* Currently we do not support hierarchy deeper than two level (0,1) */
> -	if (parent != cgroup->top_cgroup)
> -		return ERR_PTR(-EPERM);
> -
>  	blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
>  	if (!blkcg)
>  		return ERR_PTR(-ENOMEM);
> Index: linux-2.6/Documentation/cgroups/blkio-controller.txt
> ===================================================================
> --- linux-2.6.orig/Documentation/cgroups/blkio-controller.txt	2010-10-28 14:19:01.000000000 -0400
> +++ linux-2.6/Documentation/cgroups/blkio-controller.txt	2010-11-02 17:51:52.000000000 -0400
> @@ -89,6 +89,33 @@ Throttling/Upper Limit policy
>  
>   Limits for writes can be put using blkio.write_bps_device file.
>  
> +Hierarchical Cgroups
> +====================
> +- Currently none of the IO control policy supports hierarhical groups. But
> +  cgroup interface does allow creation of hierarhical cgroups and internally
> +  IO policies treat them as flat hierarchy.
> +
> +  So this patch will allow creation of cgroup hierarhcy but at the backend
> +  everything will be treated as flat. So if somebody created a hierarchy like
> +  as follows.
> +
> +			root
> +			/  \
> +		     test1 test2
> +			|
> +		     test3
> +
> +  CFQ and throttling will practically treat all groups at same level.
> +
> +				pivot
> +			     /  |   \  \
> +			root  test1 test2  test3
> +
> +  Down the line we can implement hierarchical accounting/control support
> +  and also introduce a new cgroup file "use_hierarchy" which will control
> +  whether cgroup hierarchy is viewed as flat or hierarchical by the policy.
> +  This is how memory controller also has implemented the things.
> +
>  Various user visible config options
>  ===================================
>  CONFIG_BLK_CGROUP

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-15 15:28 ` Vivek Goyal
@ 2010-11-15 18:38   ` Jens Axboe
  0 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2010-11-15 18:38 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: linux kernel mailing list, Gui Jianfeng, Balbir Singh,
	KAMEZAWA Hiroyuki, Li Zefan, Nauman Rafique, Daniel P. Berrange

On 2010-11-15 16:28, Vivek Goyal wrote:
> On Tue, Nov 02, 2010 at 06:20:30PM -0400, Vivek Goyal wrote:
>> o Allow hierarchical cgroup creation for blkio controller
>>
>> o Currently we disallow it as both the io controller policies (throttling
>>   as well as proportion bandwidth) do not support hierarhical accounting
>>   and control. But the flip side is that blkio controller can not be used with
>>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
>>
>>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
>>
>> o So this patch will allow creation of cgroup hierarhcy but at the backend
>>   everything will be treated as flat. So if somebody created a an hierarchy
>>   like as follows.
>>
>> 			root	
>> 			/  \
>> 		     test1 test2
>> 			|
>> 		     test3
>>
>>   CFQ and throttling will practically treat all groups at same level.
>> 			
>> 				pivot
>> 			     /  |   \  \
>> 			root  test1 test2  test3
>>
>> o Once we have actual support for hierarchical accounting and control
>>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>>   which will be 0 by default but if user wants to enforce hierarhical
>>   control then it can be set to 1. This way there should not be any
>>   ABI problems down the line.
>>
>> o The only not so pretty part is introduction of extra file "use_hierarchy"
>>   down the line. Kame-san had mentioned that hierarhical accounting is
>>   expensive in memory controller hence they keep it off by default. I
>>   suspect same will be the case for IO controller also as for each IO
>>   completion we shall have to account IO through hierarchy up to the root..
>>   if yes, then it probably is not a very bad idea to introduce this extra
>>   file so that it will be used only when somebody needs it and some people
>>   might enable hierarchy only in part of the hierarchy. 
>>
>> o This is how basically memory controller also uses "use_hierarhcy" and
>>   they also allowed creation of hierarchies when actual backend support
>>   was not available.
>>
>> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
>> ---
> 
> Hi Jens,
> 
> Do you have any concerns about this patch? If not, can you please apply
> it.

Applied to for-2.6.38/rc2-holder, it'll be merged into for-2.6.38/core
once -rc2 has been tagged (and I can pull in the conflicting bits).

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC] blk-cgroup: Allow creation of hierarchical cgroups
  2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
                   ` (4 preceding siblings ...)
  2010-11-15 15:28 ` Vivek Goyal
@ 2010-11-16  2:50 ` KAMEZAWA Hiroyuki
  5 siblings, 0 replies; 9+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-11-16  2:50 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Jens Axboe, linux kernel mailing list, Gui Jianfeng,
	Balbir Singh, Li Zefan, Nauman Rafique, Daniel P. Berrange

On Tue, 2 Nov 2010 18:20:30 -0400
Vivek Goyal <vgoyal@redhat.com> wrote:

> o Allow hierarchical cgroup creation for blkio controller
> 
> o Currently we disallow it as both the io controller policies (throttling
>   as well as proportion bandwidth) do not support hierarhical accounting
>   and control. But the flip side is that blkio controller can not be used with
>   libvirt as libvirt creates a cgroup hierarchy deeper than 1 level.
> 
>   <top-level-cgroup-dir>/<controller>/libvirt/qemu/<virtual-machine-groups>
> 
> o So this patch will allow creation of cgroup hierarhcy but at the backend
>   everything will be treated as flat. So if somebody created a an hierarchy
>   like as follows.
> 
> 			root	
> 			/  \
> 		     test1 test2
> 			|
> 		     test3
> 
>   CFQ and throttling will practically treat all groups at same level.
> 			
> 				pivot
> 			     /  |   \  \
> 			root  test1 test2  test3
> 
> o Once we have actual support for hierarchical accounting and control
>   then we can introduce another cgroup tunable file "blkio.use_hierarchy"
>   which will be 0 by default but if user wants to enforce hierarhical
>   control then it can be set to 1. This way there should not be any
>   ABI problems down the line.
> 
> o The only not so pretty part is introduction of extra file "use_hierarchy"
>   down the line. Kame-san had mentioned that hierarhical accounting is
>   expensive in memory controller hence they keep it off by default. I
>   suspect same will be the case for IO controller also as for each IO
>   completion we shall have to account IO through hierarchy up to the root.
>   if yes, then it probably is not a very bad idea to introduce this extra
>   file so that it will be used only when somebody needs it and some people
>   might enable hierarchy only in part of the hierarchy. 
> 
> o This is how basically memory controller also uses "use_hierarhcy" and
>   they also allowed creation of hierarchies when actual backend support
>   was not available.
> 
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>

Thank you!

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>



> ---
>  Documentation/cgroups/blkio-controller.txt |   27 +++++++++++++++++++++++++++
>  block/blk-cgroup.c                         |    4 ----
>  2 files changed, 27 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/block/blk-cgroup.c
> ===================================================================
> --- linux-2.6.orig/block/blk-cgroup.c	2010-10-28 14:19:02.000000000 -0400
> +++ linux-2.6/block/blk-cgroup.c	2010-11-02 13:10:13.000000000 -0400
> @@ -1452,10 +1452,6 @@ blkiocg_create(struct cgroup_subsys *sub
>  		goto done;
>  	}
>  
> -	/* Currently we do not support hierarchy deeper than two level (0,1) */
> -	if (parent != cgroup->top_cgroup)
> -		return ERR_PTR(-EPERM);
> -
>  	blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
>  	if (!blkcg)
>  		return ERR_PTR(-ENOMEM);
> Index: linux-2.6/Documentation/cgroups/blkio-controller.txt
> ===================================================================
> --- linux-2.6.orig/Documentation/cgroups/blkio-controller.txt	2010-10-28 14:19:01.000000000 -0400
> +++ linux-2.6/Documentation/cgroups/blkio-controller.txt	2010-11-02 17:51:52.000000000 -0400
> @@ -89,6 +89,33 @@ Throttling/Upper Limit policy
>  
>   Limits for writes can be put using blkio.write_bps_device file.
>  
> +Hierarchical Cgroups
> +====================
> +- Currently none of the IO control policy supports hierarhical groups. But
> +  cgroup interface does allow creation of hierarhical cgroups and internally
> +  IO policies treat them as flat hierarchy.
> +
> +  So this patch will allow creation of cgroup hierarhcy but at the backend
> +  everything will be treated as flat. So if somebody created a hierarchy like
> +  as follows.
> +
> +			root
> +			/  \
> +		     test1 test2
> +			|
> +		     test3
> +
> +  CFQ and throttling will practically treat all groups at same level.
> +
> +				pivot
> +			     /  |   \  \
> +			root  test1 test2  test3
> +
> +  Down the line we can implement hierarchical accounting/control support
> +  and also introduce a new cgroup file "use_hierarchy" which will control
> +  whether cgroup hierarchy is viewed as flat or hierarchical by the policy.
> +  This is how memory controller also has implemented the things.
> +
>  Various user visible config options
>  ===================================
>  CONFIG_BLK_CGROUP
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-11-16  2:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 22:20 [RFC] blk-cgroup: Allow creation of hierarchical cgroups Vivek Goyal
2010-11-03  0:11 ` Chad Talbott
2010-11-03 13:26   ` Vivek Goyal
2010-11-03  2:27 ` Balbir Singh
2010-11-03  4:14 ` Gui Jianfeng
2010-11-03 15:03 ` Ciju Rajan K
2010-11-15 15:28 ` Vivek Goyal
2010-11-15 18:38   ` Jens Axboe
2010-11-16  2:50 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).