From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 5/6] API/cgroups: Auto add controllers to subtree_control in new subgroup
Date: Thu, 20 May 2021 09:40:13 +0100 [thread overview]
Message-ID: <874kexlrwy.fsf@suse.de> (raw)
In-Reply-To: <YKT5ZHrFW0/tCIhu@yuki>
Hello,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> - if (dir->dir_root->ver == TST_CGROUP_V2)
>> + if (dir->dir_root->ver != TST_CGROUP_V1)
>> cg->dirs_by_ctrl[0] = dir;
>
> This change is useless, isn't it?
Hopefully there will be no V3, but if there is it will most likely be a
unified hierarchy like V2.
Maybe this should have been in a seperate patch though?
>
>> for_each_ctrl(ctrl) {
>> - if (has_ctrl(dir->ctrl_field, ctrl))
>> - cg->dirs_by_ctrl[ctrl->ctrl_indx] = dir;
>> + if (!has_ctrl(dir->ctrl_field, ctrl))
>> + continue;
>> +
>> + cg->dirs_by_ctrl[ctrl->ctrl_indx] = dir;
>> +
>> + if (!parent || dir->dir_root->ver == TST_CGROUP_V1)
>> + continue;
>> +
>> + SAFE_CGROUP_PRINTF(parent, "cgroup.subtree_control",
>> + "+%s", ctrl->ctrl_name);
>> }
>
> Looks good. Agree that we should copy the controllers from parent here
> for V2.
Yup, as suggested by Li Wang.
>
>> for (i = 0; cg->dirs[i]; i++);
>> @@ -876,7 +885,7 @@ tst_cgroup_group_mk(const struct tst_cgroup_group *const parent,
>> for_each_dir(parent, 0, dir) {
>> new_dir = SAFE_MALLOC(sizeof(*new_dir));
>> cgroup_dir_mk(*dir, group_name, new_dir);
>> - cgroup_group_add_dir(cg, new_dir);
>> + cgroup_group_add_dir(parent, cg, new_dir);
>> }
>>
>> return cg;
>> @@ -1029,7 +1038,7 @@ static struct tst_cgroup_group *cgroup_group_from_roots(const size_t tree_off)
>> dir = (typeof(dir))(((char *)root) + tree_off);
>>
>> if (dir->ctrl_field)
>> - cgroup_group_add_dir(cg, dir);
>> + cgroup_group_add_dir(NULL, cg, dir);
>> }
>>
>> if (cg->dirs[0]) {
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Thank you,
Richard.
next prev parent reply other threads:[~2021-05-20 8:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 15:21 [LTP] [PATCH 0/6] cfs_bandwidth01 and CGroup API Richard Palethorpe
2021-05-13 15:21 ` [LTP] [PATCH 1/6] API/cgroups: Allow fetching of CGroup name Richard Palethorpe
2021-05-19 11:14 ` Cyril Hrubis
2021-05-13 15:21 ` [LTP] [PATCH 2/6] API/cgroups: Remove obsolete function in API Richard Palethorpe
2021-05-19 11:15 ` Cyril Hrubis
2021-05-13 15:21 ` [LTP] [PATCH 3/6] API/cgroups: Check for unknown controller name Richard Palethorpe
2021-05-19 11:20 ` Cyril Hrubis
2021-05-20 8:13 ` Richard Palethorpe
2021-05-13 15:21 ` [LTP] [PATCH 4/6] API/cgroups: Add cpu controller Richard Palethorpe
2021-05-19 11:30 ` Cyril Hrubis
2021-05-20 8:35 ` Richard Palethorpe
2021-05-13 15:21 ` [LTP] [PATCH 5/6] API/cgroups: Auto add controllers to subtree_control in new subgroup Richard Palethorpe
2021-05-19 11:41 ` Cyril Hrubis
2021-05-20 8:40 ` Richard Palethorpe [this message]
2021-05-13 15:21 ` [LTP] [PATCH 6/6] sched/cgroup: Add cfs_bandwidth01 Richard Palethorpe
2021-05-19 11:51 ` Cyril Hrubis
2021-05-20 8:10 ` Cyril Hrubis
2021-05-20 8:50 ` Richard Palethorpe
2021-05-21 9:29 ` Richard Palethorpe
2021-05-25 9:06 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874kexlrwy.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox