[LTP] [PATCH] memcg/memcontrol04: Fix the judgment error in test_memcg_low()

Andrea Cervesato andrea.cervesato@suse.com
Mon Nov 25 10:45:31 CET 2024


Hi Jin,

I can't share the bugzilla content, but the test has been analyzed quite 
a lot and people didn't figure out a proper fix for it.
Linux is highly asynchronous and the memory management is not always 
predictable. Most of the times, testing memory requires a good knowledge 
of the underlying algorithms and, even so, it's not so obvious to write 
tests for it. Sometimes we end up having a test result based on 
**average reply** from the test (i.e. if we obtain TPASS 70 times out of 
100, we can consider test pass).

As far as I see, devs think this test should be rewritten or simplified, 
in order to reduce the noise in LTP, testing only features which can be 
actually tested.

Feel free to take a look if you think it's worth the energy, but I also 
suggest to take a look at the kernel, because it could be there's an 
underlying bug somewhere.

Kind regards,
Andrea Cervesato

On 11/21/24 14:18, Jin Guojie wrote:
> When I visit https://bugzilla.suse.com/show_bug.cgi?id=1196298, an
> error occurs showing that
>
> "You are not authorized to access bug #1196298."
>
> I tried to register an account by myself, but the error did not change.
>
> So far, I still can't view the link.
>
> Please see if there is a way to give me permission to view this bug.
>
> Or, could you please provide me the explanation of this bug in the email?
>
> On Thu, Nov 21, 2024 at 5:44 PM Andrea Cervesato
> <andrea.cervesato@suse.com> wrote:
>> Hi!
>>
>> Thanks for checking this test, but did you take a look at the
>> explanation given in the test "tags" ? ->
>> https://bugzilla.suse.com/show_bug.cgi?id=1196298
>>
>> Regards,
>> Andrea
>>
>> On 11/21/24 04:05, Jin Guojie wrote:
>>> When running memcontrol04, TFAIL results will appear on various Linux
>>> distributions, kernel versions, and CPUs:
>>>
>>> (1) Test platform
>>>
>>> * Linux distribution: Ubuntu 24.10
>>> * CPU: X86_64, Arm64
>>> * Kernel: 6.6 longterm
>>> * glibc:  2.40
>>> * LTP version:  commit ec4161186e5, Oct 24 12:18:17 2024
>>>
>>> (2) Error logs
>>>
>>> During the operation of memcontrol04, file systems such as ext2, ext3,
>>> ext4, xfs, ntfs, and vfat will be tested.
>>> For any of the file system, the same TFAIL result will appear:
>>>
>>> root@vm:~/ltp/testcases/kernel/controllers/memcg# ./memcontrol04
>>>
>>> tst_test.c:1823: TINFO: === Testing on ext2 ===
>>> memcontrol04.c:208: TPASS: Expect: (C oom events=0) == 0
>>> memcontrol04.c:211: TPASS: Expect: (C low events=437) > 0
>>> memcontrol04.c:208: TPASS: Expect: (D oom events=0) == 0
>>> memcontrol04.c:211: TPASS: Expect: (D low events=437) > 0
>>> memcontrol04.c:208: TPASS: Expect: (E oom events=0) == 0
>>> memcontrol04.c:214: TPASS: Expect: (E low events=0) == 0
>>> memcontrol04.c:208: TPASS: Expect: (F oom events=0) == 0
>>> memcontrol04.c:214: TFAIL: Expect: (F low events=412) == 0
>>>
>>> tst_test.c:1823: TINFO: === Testing on ext3 ===
>>> memcontrol04.c:208: TPASS: Expect: (C oom events=0) == 0
>>> memcontrol04.c:211: TPASS: Expect: (C low events=437) > 0
>>> memcontrol04.c:208: TPASS: Expect: (D oom events=0) == 0
>>> memcontrol04.c:211: TPASS: Expect: (D low events=437) > 0
>>> memcontrol04.c:208: TPASS: Expect: (E oom events=0) == 0
>>> memcontrol04.c:214: TPASS: Expect: (E low events=0) == 0
>>> memcontrol04.c:208: TPASS: Expect: (F oom events=0) == 0
>>> memcontrol04.c:214: TFAIL: Expect: (F low events=411) == 0
>>>
>>> ......
>>>
>>> Summary:
>>> passed   55
>>> failed   5
>>> broken   0
>>> skipped  0
>>> warnings 0
>>>
>>> It looks like there is an error in the processing logic of cgroup F.
>>>
>>> (3) Cause analysis
>>>
>>> In the test_memcg_low() function, 4 subgroups (C, D, E, F) are created under B,
>>> and 50MB pagecache is allocated in C, D, and F. Therefore, when checking whether
>>> it is successful at the end, only E should be judged to have low_events==0,
>>> and the judgment conditions for all other subgroups should be low_events > 0.
>>>
>>> (4) Fix issure
>>>
>>> #1209
>>> https://github.com/linux-test-project/ltp/issues/1209
>>>
>>> Signed-off-by: Jin Guojie <guojie.jin@gmail.com>
>>>
>>> ---
>>>    testcases/kernel/controllers/memcg/memcontrol04.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c
>>> b/testcases/kernel/controllers/memcg/memcontrol04.c
>>> index 1b8d115f8..0dddb7449 100644
>>> --- a/testcases/kernel/controllers/memcg/memcontrol04.c
>>> +++ b/testcases/kernel/controllers/memcg/memcontrol04.c
>>> @@ -207,7 +207,7 @@ static void test_memcg_low(void)
>>>
>>>                   TST_EXP_EXPR(oom == 0, "(%c oom events=%ld) == 0", id, oom);
>>>
>>> -               if (i < E) {
>>> +               if (i != E) {
>>>                           TST_EXP_EXPR(low > 0,
>>>                                        "(%c low events=%ld) > 0", id, low);
>>>                   } else {
>>> --
>>> 2.45.2
>>>


More information about the ltp mailing list