From: Sachin Sant <sachinp@linux.ibm.com>
To: pavrampu@linux.ibm.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] Fix memcontrol04 test failures on PowerPC64 architecture.
Date: Thu, 23 Apr 2026 19:54:45 +0530 [thread overview]
Message-ID: <d830bdb8-e355-4d74-af0c-8678d6bfad7e@linux.ibm.com> (raw)
In-Reply-To: <69d8e6e5.5d0a0220.90693.5372@mx.google.com>
On 10/04/26 5:32 pm, Andrea Cervesato via ltp wrote:
> Hi Pavithra,
>
> please take a look at this review before proceeding. I think this
> patch is not needed, but at least you can try and see if other
> people will spot something useful.
>
> https://github.com/acerv/ltp-agent/actions/runs/24189485745
>
> memcontrol0[34] have a long story of sporadic failures related to
> the kernel async nature and memory management implementation, so
> I believe this is not gonna fix the test in the long run.
>
> But maybe I'm wrong. It's better if you send a v2 first, fixing
> the issues, then other people can properly review it.
Hi Pavithra,
The fix doesn't seem to address the real problem. This test does seem flaky.
Depending on how many iterations are executed, the fail count can vary.
I tried some debugging on one of the system I had access to.
The test fails with memory.current values much lower than expected:
TFAIL: (A/B/C memory.current=6684672) ~= 34603008
TFAIL: (A/B/D memory.current=5373952) ~= 17825792
It seems the child processes allocating pagecache were exiting
immediately after allocation (via tst_reap_children()), causing the
pagecache to be freed before the test could measure memory.current values.
A potential fix can be as follows:
Modify alloc_pagecache_in_child() to keep children alive during test:
- Add TEST_DONE checkpoint for child lifecycle coordination
- Parent waits for CHILD_IDLE checkpoint before proceeding
- Child signals CHILD_IDLE after allocation and fsync
- Child waits for TEST_DONE to keep memory allocated during test
- Modify cleanup_sub_groups() to wake waiting children before cleanup
- Change alloc_anon_in_child() to use SAFE_WAITPID() for specific child
This will ensure pagecache remains allocated during memory pressure
testing, allowing correct memory.current measurements.
Untested patch:
diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c
b/testcases/kernel/controllers/memcg/memcontrol04.c
index 715cc5bcd..d0188a1da 100644
--- a/testcases/kernel/controllers/memcg/memcontrol04.c
+++ b/testcases/kernel/controllers/memcg/memcontrol04.c
@@ -47,7 +47,8 @@ static struct tst_cg_group *leaf_cg[4];
static int fd = -1;
enum checkpoints {
- CHILD_IDLE
+ CHILD_IDLE,
+ TEST_DONE,
};
enum trunk_cg {
@@ -67,6 +68,16 @@ static void cleanup_sub_groups(void)
{
size_t i;
+ for (i = ARRAY_SIZE(leaf_cg); i > 0; i--) {
+ if (!leaf_cg[i - 1])
+ continue;
+
+ TST_CHECKPOINT_WAKE2(TEST_DONE,
+ ARRAY_SIZE(leaf_cg) - 1);
+ tst_reap_children();
+ break;
+ }
+
for (i = ARRAY_SIZE(leaf_cg); i > 0; i--) {
if (!leaf_cg[i - 1])
continue;
@@ -88,7 +99,7 @@ static void alloc_anon_in_child(const struct
tst_cg_group *const cg,
const pid_t pid = SAFE_FORK();
if (pid) {
- tst_reap_children();
+ SAFE_WAITPID(pid, NULL, 0);
return;
}
@@ -107,7 +118,7 @@ static void alloc_pagecache_in_child(const struct
tst_cg_group *const cg,
const pid_t pid = SAFE_FORK();
if (pid) {
- tst_reap_children();
+ TST_CHECKPOINT_WAIT(CHILD_IDLE);
return;
}
@@ -117,6 +128,11 @@ static void alloc_pagecache_in_child(const struct
tst_cg_group *const cg,
getpid(), tst_cg_group_name(cg), size);
alloc_pagecache(fd, size);
+ SAFE_FSYNC(fd);
+
+ TST_CHECKPOINT_WAKE(CHILD_IDLE);
+ TST_CHECKPOINT_WAIT(TEST_DONE);
+
exit(0);
}
--
Thanks
- Sachin
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-04-23 14:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 5:01 [LTP] [PATCH] Fix memcontrol04 test failures on PowerPC64 architecture Pavithra
2026-04-10 12:02 ` Andrea Cervesato via ltp
2026-04-23 14:24 ` Sachin Sant [this message]
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=d830bdb8-e355-4d74-af0c-8678d6bfad7e@linux.ibm.com \
--to=sachinp@linux.ibm.com \
--cc=ltp@lists.linux.it \
--cc=pavrampu@linux.ibm.com \
/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