Skip to contentSkip to conversation

cpuset_memory: Print basic subtest descriptions

PATCH In review Martin Doucha 4 participants 7 messages Dec 16, 2025 – Dec 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cpuset_memory: Print basic subtest descriptions

The cpuset_memory tests has multiple subtests. Print short description before each subtest to simplify debugging. The last three subtests have the same description because they differ only in the specific pattern of signals sent to the parent and child allocator threads.

---
 .../cpuset_memory_test/cpuset_memory_testset.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +17 -0
index e81d22293..1f68d7444 100755
@@ -63,6 +63,7 @@ simple_getresult()
 
 test1()
 {
+	tst_resm TINFO "Testing anonymous memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -80,6 +81,7 @@ test1()
 
 test2()
 {
+	tst_resm TINFO "Testing file memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -97,6 +99,7 @@ test2()
 
 test3()
 {
+	tst_resm TINFO "Testing SHM memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -114,6 +117,7 @@ test3()
 
 test4()
 {
+	tst_resm TINFO "Testing pre-mlocked anonymous memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -131,6 +135,7 @@ test4()
 
 test5()
 {
+	tst_resm TINFO "Testing mlocked anonymous memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -162,6 +167,7 @@ check_hugetlbfs()
 
 test6()
 {
+	tst_resm TINFO "Testing hugepage SHM memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -201,6 +207,7 @@ test6()
 
 test7()
 {
+	tst_resm TINFO "Testing anonymous memory allocation on node 0."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -218,6 +225,7 @@ test7()
 
 test8()
 {
+	tst_resm TINFO "Testing anonymous memory allocation on node 1."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -254,6 +262,7 @@ talk2memory_test_for_case_10_11()
 
 test9()
 {
+	tst_resm TINFO "Testing anonymous memory allocation in multiple cpusets."
 	cpuset_set "$CPUSET/1" "$cpus_all" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -292,6 +301,7 @@ test9()
 
 test10()
 {
+	tst_resm TINFO "Testing anonymous memory allocation in multiple cpusets with migration."
 	cpuset_set "$CPUSET/1" "$cpus_all" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -358,6 +368,7 @@ talk2memory_test_for_case_12_13()
 
 test11()
 {
+	tst_resm TINFO "Testing anonymous memory allocation on multiple nodes without migration."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -386,6 +397,7 @@ test11()
 
 test12()
 {
+	tst_resm TINFO "Testing anonymous memory allocation on multiple nodes with migration."
 	cpuset_set "$CPUSET/0" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -442,6 +454,7 @@ get_the_second()
 
 test13()
 {
+	tst_resm TINFO "Testing anonymous memory allocation in multiple cpusets with threads."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -490,6 +503,7 @@ test13()
 
 test14()
 {
+	tst_resm TINFO "Testing anonymous memory allocation in multiple cpusets with threads and migration."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -546,6 +560,7 @@ test14()
 
 test15()
 {
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "0" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -613,6 +628,7 @@ test15()
 
 test16()
 {
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -688,6 +704,7 @@ test16()
 
 test17()
 {
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 2/2 cpuset_memory: Fix race in multinode subtests

In two subtests, memory allocation races against a change of the allowed cpuset nodes list. This causes random failures. Add the missing sleep to ensure that memory allocation completes before the allowed nodes get changed.

---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +1 -1
index 1f68d7444..d13c605e2 100755
@@ -354,7 +354,7 @@ talk2memory_test_for_case_12_13()
 	sleep 1
 	echo $1 > "$2/tasks"
 	/bin/kill -s SIGUSR1 $1
-
+	sleep 1
 	echo 0 > "$2/cpuset.mems" || return 1
 	sleep 1
 	/bin/kill -s SIGUSR1 $1
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests

Hi Martin,

Quoted 15 lines

In two subtests, memory allocation races against a change of the allowed cpuset nodes list. This causes random failures. Add the missing sleep to ensure that memory allocation completes before the allowed nodes get changed.

---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +0 -0
index 1f68d7444..d13c605e2 100755

testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh talk2memory_test_for_case_12_13() · line 357

Quoted 5 lines
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +1 -1
@@ -354,7 +354,7 @@ talk2memory_test_for_case_12_13()
 	sleep 1
 	echo $1 > "$2/tasks"
 	/bin/kill -s SIGUSR1 $1
-
+	sleep 1

Thanks for the fix, this patch merged!

I wonder if this very old test is in a long run worth to rewrite into C, as depending on sleep is not a good idea and C API would hopefully help to avoid it. (Yeah, we discuss sleep as a part of ground rules [1].)

Kind regards,
Petr

[1] https://lore.kernel.org/ltp/[email protected]/

Quoted 3 lines
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +0 -0
 	echo 0 > "$2/cpuset.mems" || return 1
 	sleep 1
 	/bin/kill -s SIGUSR1 $1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests

Hi,

Quoted 3 lines

I wonder if this very old test is in a long run worth to rewrite into C, as depending on sleep is not a good idea and C API would hopefully help to avoid it. (Yeah, we discuss sleep as a part of ground rules [1].)

I tried, and I gave up :-) too many testcases and a really messy code. I really wish we could rewrite it, but this is one of those tests which is not worth the effort.

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests

Hi!

Quoted 7 lines
Quoted 3 lines

I wonder if this very old test is in a long run worth to rewrite into C, as depending on sleep is not a good idea and C API would hopefully help to avoid it. (Yeah, we discuss sleep as a part of ground rules [1].)

I tried, and I gave up :-) too many testcases and a really messy code. I really wish we could rewrite it, but this is one of those tests which is not worth the effort.

We will have to rewrite it eventually, it's not that complex, just big. I guess that we need to isolate and rewrite one test after another while putting the common code into a library.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
In reply to Martin Doucha

Hi Martin,

Quoted 4 lines

The cpuset_memory tests has multiple subtests. Print short description before each subtest to simplify debugging. The last three subtests have the same description because they differ only in the specific pattern of signals sent to the parent and child allocator threads.

Yeah, it makes sense as ith has 17 tests.

...

Review

Quoted 3 lines

test16()
{

(quoted diff) +1 -0
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."

How about using $1 to print number of the test (on each message, not on the last three)?
nit: Also, could we remove the trailing dot?

tst_resm TINFO "$1 Testing anonymous memory reallocation in multiple cpusets with threads and migration"

If you agree I can do both before merge.

Kind regards,
Petr

Quoted 11 lines
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +1 -0
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
@@ -688,6 +704,7 @@ test16()
 
 test17()
 {
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."
 	cpuset_set "$CPUSET/1" "$cpu_of_node0" "1" "0" 2> $CPUSET_TMP/stderr
 	if [ $? -ne 0 ]; then
 		cpuset_log_error $CPUSET_TMP/stderr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
Quoted 18 lines · Petr Vorel

Hi Martin,

Quoted 4 lines

The cpuset_memory tests has multiple subtests. Print short description before each subtest to simplify debugging. The last three subtests have the same description because they differ only in the specific pattern of signals sent to the parent and child allocator threads.

Yeah, it makes sense as ith has 17 tests.

...

Review

Quoted 3 lines
  test16()
  {
(quoted diff) +1 -0
+	tst_resm TINFO "Testing anonymous memory reallocation in multiple cpusets with threads and migration."

How about using $1 to print number of the test (on each message, not on the last three)?
nit: Also, could we remove the trailing dot?

Quoted 3 lines

tst_resm TINFO "$1 Testing anonymous memory reallocation in multiple cpusets with threads and migration"

If you agree I can do both before merge.

Hello,
feel free to do both. But $1 is not set in the subtest calls so don't forget to also add the argument on line 794.

Signature · 10 lines
Martin Doucha   [email protected]
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

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