[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC4Lta0tD=FbtVpGnLw2sKMY69+AnqYqaOvCQdFs88JeR5Pemw@mail.gmail.com>
Date: Thu, 17 Apr 2014 23:33:50 +0530
From: Raghavendra KT <raghavendra.kt@...ux.vnet.ibm.com>
To: Tejun Heo <tj@...nel.org>
Cc: lizefan@...wei.com, containers@...ts.linux-foundation.org,
cgroups@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 12/12] cgroup: implement dynamic subtree controller
enable/disable on the default hierarchy
On Tue, Apr 15, 2014 at 3:07 AM, Tejun Heo <tj@...nel.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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists