[LTP] [PATCH 3/3] memcontrol04: Copy from kselftest

Li Wang liwang@redhat.com
Thu Feb 10 08:12:20 CET 2022


On Thu, Feb 10, 2022 at 2:23 PM Li Wang <liwang@redhat.com> wrote:

>
>
> On Wed, Feb 9, 2022 at 7:05 PM Li Wang <liwang@redhat.com> wrote:
>
>
>> Btw, there are some TFAILs from my manual run.
>> (I will look into that try to figure it out tomorrow)
>>
>> tst_test.c:1521: TINFO: Testing on ext4
>> tst_test.c:996: TINFO: Formatting /dev/loop0 with ext4 opts='' extra
>> opts=''
>> mke2fs 1.46.5 (30-Dec-2021)
>> tst_test.c:1452: TINFO: Timeout per run is 0h 05m 00s
>> memcontrol04.c:118: TINFO: Child 242775 in leaf_C: Allocating pagecache:
>> 52428800
>> memcontrol04.c:118: TINFO: Child 242776 in leaf_D: Allocating pagecache:
>> 52428800
>> memcontrol04.c:118: TINFO: Child 242777 in leaf_F: Allocating pagecache:
>> 52428800
>> memcontrol04.c:99: TINFO: Child 242778 in trunk_G: Allocating anon:
>> 155189248
>> memcontrol04.c:170: TPASS: Expect: (A/B memory.current=54181888) ~=
>> 52428800
>> memcontrol04.c:176: TPASS: Expect: (A/B/C memory.current=30957568) ~=
>> 34603008
>> memcontrol04.c:178: TPASS: Expect: (A/B/D memory.current=22282240) ~=
>> 17825792
>> memcontrol04.c:180: TPASS: Expect: (A/B/E memory.current=0) ~= 0
>> memcontrol04.c:99: TINFO: Child 242779 in trunk_G: Allocating anon:
>> 174063616
>> memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0
>> memcontrol04.c:196: TPASS: Expect: (low events=373) > 0
>> memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0
>> memcontrol04.c:196: TPASS: Expect: (low events=373) > 0
>> memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0
>> memcontrol04.c:198: TPASS: Expect: (low events=0) == 0
>> memcontrol04.c:193: TPASS: Expect: (oom events=0) == 0
>> memcontrol04.c:198: TFAIL: Expect: (low events=370) == 0
>>
>
> It looks like a logic issue here, as we do alloc_pagecache 50MB
> respectively in the leaf_cg[C, D, E, F] and only the 'memory.low'
>

My apologies, the leaf_cg[E] does not have 50MB page cache
allocating, that is the main reason with no memory reclaims happening.
'500MB' low boundary obviously overcommitment, so leaf_cg[E] will
get the part of parent’s protection proportional to its actual memory
usage. However, it doesn't matter for this case, leaf_cg[E] can get
no event grows as well. Because it has no memory consumption at all.

The fix is still effective unless I misread something again:).



> of leaf_cg[E] is large enough (500MB) to avoid triggering low event.
> The rest cgroups should all have low events, that kernel behavior
> is correct.
>
> This failure should be fix with:
>
> --- a/testcases/kernel/controllers/memcg/memcontrol04.c
> +++ b/testcases/kernel/controllers/memcg/memcontrol04.c
> @@ -192,7 +192,7 @@ static void test_memcg_low(void)
>
>                 TST_EXP_EXPR(oom == 0, "(oom events=%ld) == 0", oom);
>
> -               if (i < E)
> +               if (i != E)
>                         TST_EXP_EXPR(low > 0, "(low events=%ld) > 0", low)
>                 else
>                         TST_EXP_EXPR(low == 0, "(low events=%ld) == 0",
> low);
>
>
> And better to add "leaf_cg%d" print in the output:
> (to show the events from which cgroup)
>
>     TST_EXP_EXPR(oom == 0, "(leaf_cg%d: oom events=%ld) == 0", i, oom);
>
>     if (i != E)
>             TST_EXP_EXPR(low > 0, "(leaf_cg%d: low events=%ld) > 0", i,
>  low)
>     else
>              TST_EXP_EXPR(low == 0, "(leaf_cg%d: low events=%ld) == 0",
> i, low);
>
> --
> Regards,
> Li Wang
>


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220210/1f2b2701/attachment.htm>


More information about the ltp mailing list