lkml.org 
[lkml]   [2014]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 12/12] cgroup: implement dynamic subtree controller enable/disable on the default hierarchy
From
On Tue, Apr 15, 2014 at 3:07 AM, Tejun Heo <tj@kernel.org> wrote:
[...]
> * White-space separated list of controller names prefixed with either
> '+' or '-' can be written to "cgroup.subtree_control". The ones
> prefixed with '+' are enabled on the controller and '-' disabled.
>

[...]

> +
> +/* change the enabled child controllers for a cgroup in the default hierarchy */
> +static int cgroup_subtree_control_write(struct cgroup_subsys_state *dummy_css,
> + struct cftype *cft, char *buffer)
> +{
> + unsigned long enable_req = 0, disable_req = 0, enable, disable;
> + struct cgroup *cgrp = dummy_css->cgroup, *child;
> + struct cgroup_subsys *ss;
> + char *tok, *p;
> + int ssid, ret;
> +
> + /*
> + * Parse input - white space separated list of subsystem names
> + * prefixed with either + or -.
> + */
> + p = buffer;
> + while ((tok = strsep(&p, " \t\n"))) {
> + for_each_subsys(ss, ssid) {
> + if (ss->disabled || strcmp(tok + 1, ss->name))
> + continue;
> +
> + if (*tok == '+') {
> + enable_req |= 1 << ssid;
> + disable_req &= ~(1 << ssid);
> + } else if (*tok == '-') {
> + disable_req |= 1 << ssid;
> + enable_req &= ~(1 << ssid);
> + } else {
> + return -EINVAL;
> + }
> + break;
> + }
> + if (ssid == CGROUP_SUBSYS_COUNT)
> + return -EINVAL;
> + }

I undertsand that with the above parsing we could do
echo "-blkio +blkio" > cgroup.subtree_control and honor last enable/disable.
It confused me while testing. do you think we should return -EINVAL in
such case?


\
 
 \ /
  Last update: 2014-04-17 20:21    [W:0.167 / U:7.040 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site