diff mbox series

memcg/memcontrol04: Fix the judgment error in test_memcg_low()

Message ID CA+B+MYSAN9kYUvmRF7ooox3koJjFf+6o73kfEWZ9oiYU2eLDjA@mail.gmail.com
State Superseded
Headers show
Series memcg/memcontrol04: Fix the judgment error in test_memcg_low() | expand

Commit Message

Jin Guojie Nov. 21, 2024, 3:01 a.m. UTC
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(-)

--
2.45.2
diff mbox series

Patch

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 {