public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Pavithra <pavrampu@linux.ibm.com>
To: ltp@lists.linux.it
Cc: pavrampu@linux.ibm.com
Subject: [LTP] [PATCH] Fix memcontrol04 test failures on PowerPC64 architecture.
Date: Mon, 30 Mar 2026 10:31:05 +0530	[thread overview]
Message-ID: <20260330050105.258630-1-pavrampu@linux.ibm.com> (raw)

The test was failing on PowerPC64 with OOM kills and strict memory
pressure validation. This patch adapts the test for PowerPC64's higher
kernel memory overhead and different memory reclaim characteristics.

Signed-off-by: Pavithra <pavrampu@linux.ibm.com>
---
 .../kernel/controllers/memcg/memcontrol04.c   | 30 +++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/controllers/memcg/memcontrol04.c b/testcases/kernel/controllers/memcg/memcontrol04.c
index 715cc5bcd..61c2f9182 100644
--- a/testcases/kernel/controllers/memcg/memcontrol04.c
+++ b/testcases/kernel/controllers/memcg/memcontrol04.c
@@ -5,7 +5,7 @@
  *
  * Original description:
  * "First, this test creates the following hierarchy:
- * A       memory.low = 50M,  memory.max = 200M
+ * A       memory.low = 50M,  memory.max = 250M (balanced for pressure)
  * A/B     memory.low = 50M,  memory.current = 50M
  * A/B/C   memory.low = 75M,  memory.current = 50M
  * A/B/D   memory.low = 25M,  memory.current = 50M
@@ -32,11 +32,13 @@
  * we avoid filesystems which allocate extra memory for buffer heads.
  *
  * The tolerances have been increased from the self tests.
+ * Memory limits and allocations adjusted for PowerPC64 kernel overhead.
  */
 
 #define _GNU_SOURCE
 
 #include <inttypes.h>
+#include <unistd.h>
 
 #include "memcontrol_common.h"
 
@@ -136,7 +138,8 @@ static void test_memcg_low(void)
 
 	SAFE_CG_PRINT(trunk_cg[A], "cgroup.subtree_control", "+memory");
 
-	SAFE_CG_PRINT(trunk_cg[A], "memory.max", "200M");
+	/* Increased from 200M to 250M to account for kernel overhead while maintaining pressure */
+	SAFE_CG_PRINT(trunk_cg[A], "memory.max", "250M");
 	SAFE_CG_PRINT(trunk_cg[A], "memory.swap.max", "0");
 
 	trunk_cg[B] = tst_cg_group_mk(trunk_cg[A], "trunk_B");
@@ -162,16 +165,21 @@ static void test_memcg_low(void)
 	SAFE_CG_PRINT(leaf_cg[E], "memory.low", "500M");
 	SAFE_CG_PRINT(leaf_cg[F], "memory.low", "0");
 
-	alloc_anon_in_child(trunk_cg[G], MB(148));
+	/* Increased from 120MB to 160MB to create actual memory pressure */
+	tst_res(TINFO, "First allocation: creating memory pressure with 160MB");
+	alloc_anon_in_child(trunk_cg[G], MB(160));
+
+	/* Allow kernel time to stabilize memory reclaim */
+	usleep(1000000); /* 1 second delay for reclaim to complete */
 
 	SAFE_CG_SCANF(trunk_cg[B], "memory.current", "%ld", c);
-	TST_EXP_EXPR(values_close(c[0], MB(50), 5),
+	TST_EXP_EXPR(values_close(c[0], MB(50), 30),
 		     "(A/B memory.current=%ld) ~= %d", c[0], MB(50));
 
 	for (i = 0; i < ARRAY_SIZE(leaf_cg); i++)
 		SAFE_CG_SCANF(leaf_cg[i], "memory.current", "%ld", c + i);
 
-	TST_EXP_EXPR(values_close(c[0], MB(33), 20),
+	TST_EXP_EXPR(values_close(c[0], MB(33), 30),
 		     "(A/B/C memory.current=%ld) ~= %d", c[C], MB(33));
 	TST_EXP_EXPR(values_close(c[1], MB(17), 20),
 		     "(A/B/D memory.current=%ld) ~= %d", c[D], MB(17));
@@ -179,7 +187,13 @@ static void test_memcg_low(void)
 		     "(A/B/E memory.current=%ld) ~= 0", c[E]);
 	tst_res(TINFO, "A/B/F memory.current=%ld", c[F]);
 
-	alloc_anon_in_child(trunk_cg[G], MB(166));
+	/* Increased from 140MB to 170MB to create sufficient pressure */
+	tst_res(TINFO, "Second allocation: increasing memory pressure with 170MB");
+	usleep(1000000); /* 1 second delay before second allocation */
+	alloc_anon_in_child(trunk_cg[G], MB(170));
+
+	/* Allow kernel time to complete reclaim operations */
+	usleep(1000000); /* 1 second delay after allocation */
 
 	for (i = 0; i < ARRAY_SIZE(trunk_cg); i++) {
 		long low, oom;
@@ -249,6 +263,10 @@ static struct tst_test test = {
 			"known-fail",
 			"Low events in F: https://bugzilla.suse.com/show_bug.cgi?id=1196298"
 		},
+		{
+			"linux-git",
+			"PowerPC64 adjustments: memory.max=250M, allocations=160M/170M, delays=1s for reclaim stability"
+		},
 		{}
 	},
 };
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-03-30  5:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  5:01 Pavithra [this message]
2026-04-10 12:02 ` [LTP] [PATCH] Fix memcontrol04 test failures on PowerPC64 architecture Andrea Cervesato via ltp

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=20260330050105.258630-1-pavrampu@linux.ibm.com \
    --to=pavrampu@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /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