[systemd-devel] [PATCH v2] cgroup-util: fix is_valid check to pass for unified cgroup hierchy.

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Thu May 28 16:24:50 PDT 2015


On 28 May 2015 at 18:08, Lennart Poettering <lennart at poettering.net> wrote:
> On Thu, 28.05.15 16:42, Dimitri John Ledkov (dimitri.j.ledkov at intel.com) wrote:
>
>> It appears in /proc/self/cgroup as `0::/'
>
> What precisely does this fix?
>
> I mean, we need to do some major rework of things before the unified
> hierarchy is really supported in systemd, and this one thing won't
> really get us too much in this regard, does it?
>

I'm starting to explore possibilities to start work towards supporting
unified cgroups hierarchy, or at least be able to boot with it. I'll
send a larger patch series in one go later than with all the bits that
offer something more tangible, albeit disabled by default behind
configure options (like kdbus) given that unified hierarchy is still
marked experimental in the kernel.

Regards,

Dimitri.


>> ---
>>
>>  v2 change: Test for unified cgroup should pass irrespective of
>>  whether allow_named is set.
>>
>>  src/shared/cgroup-util.c    | 4 ++++
>>  src/test/test-cgroup-util.c | 3 ++-
>>  2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
>> index c0b0ca4..eda7523 100644
>> --- a/src/shared/cgroup-util.c
>> +++ b/src/shared/cgroup-util.c
>> @@ -1616,6 +1616,10 @@ bool cg_controller_is_valid(const char *p, bool allow_named) {
>>          if (!p)
>>                  return false;
>>
>> +        /* Unified cgroup */
>> +        if (*p == 0)
>> +                return true;
>> +
>>          if (allow_named) {
>>                  s = startswith(p, "name=");
>>                  if (s)
>> diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
>> index 4a89f64..015d3d7 100644
>> --- a/src/test/test-cgroup-util.c
>> +++ b/src/test/test-cgroup-util.c
>> @@ -247,7 +247,8 @@ static void test_controller_is_valid(void) {
>>          assert_se(cg_controller_is_valid("foobar", false));
>>          assert_se(cg_controller_is_valid("foo_bar", false));
>>          assert_se(cg_controller_is_valid("name=foo", true));
>> -        assert_se(!cg_controller_is_valid("", false));
>> +        assert_se(cg_controller_is_valid("", true));
>> +        assert_se(cg_controller_is_valid("", false));
>>          assert_se(!cg_controller_is_valid("name=", true));
>>          assert_se(!cg_controller_is_valid("=", false));
>>          assert_se(!cg_controller_is_valid("cpu,cpuacct", false));
>> --
>> 2.1.4
>>
>> _______________________________________________
>> systemd-devel mailing list
>> systemd-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
> Lennart
>
> --
> Lennart Poettering, Red Hat



-- 
Regards,

Dimitri.
Pura Vida!

https://clearlinux.org
Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.


More information about the systemd-devel mailing list