public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions
@ 2025-12-16 17:30 Martin Doucha
  2025-12-16 17:30 ` [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests Martin Doucha
  2025-12-17  7:12 ` [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Petr Vorel
  0 siblings, 2 replies; 7+ messages in thread
From: Martin Doucha @ 2025-12-16 17:30 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 .../cpuset_memory_test/cpuset_memory_testset.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
index e81d22293..1f68d7444 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
@@ -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
-- 
2.51.0


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests
  2025-12-16 17:30 [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Martin Doucha
@ 2025-12-16 17:30 ` Martin Doucha
  2025-12-17  7:08   ` Petr Vorel
  2025-12-17  7:12 ` [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Petr Vorel
  1 sibling, 1 reply; 7+ messages in thread
From: Martin Doucha @ 2025-12-16 17:30 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
index 1f68d7444..d13c605e2 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
@@ -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
-- 
2.51.0


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests
  2025-12-16 17:30 ` [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests Martin Doucha
@ 2025-12-17  7:08   ` Petr Vorel
  2025-12-17  7:13     ` Andrea Cervesato via ltp
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2025-12-17  7:08 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

> 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.

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
> index 1f68d7444..d13c605e2 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
> @@ -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/20251215124404.16395-2-chrubis@suse.cz/


>  	echo 0 > "$2/cpuset.mems" || return 1
>  	sleep 1
>  	/bin/kill -s SIGUSR1 $1

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions
  2025-12-16 17:30 [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Martin Doucha
  2025-12-16 17:30 ` [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests Martin Doucha
@ 2025-12-17  7:12 ` Petr Vorel
  2025-12-17 10:26   ` Martin Doucha
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2025-12-17  7:12 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

> 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.

...
>  test16()
>  {
> +	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

>  	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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests
  2025-12-17  7:08   ` Petr Vorel
@ 2025-12-17  7:13     ` Andrea Cervesato via ltp
  2025-12-17  9:39       ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Andrea Cervesato via ltp @ 2025-12-17  7:13 UTC (permalink / raw)
  To: Petr Vorel, Martin Doucha; +Cc: ltp

Hi,

> 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.

-- 
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests
  2025-12-17  7:13     ` Andrea Cervesato via ltp
@ 2025-12-17  9:39       ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2025-12-17  9:39 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi!
> > 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.

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions
  2025-12-17  7:12 ` [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Petr Vorel
@ 2025-12-17 10:26   ` Martin Doucha
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Doucha @ 2025-12-17 10:26 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On 12/17/25 08:12, Petr Vorel wrote:
> Hi Martin,
> 
>> 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.
> 
> ...
>>   test16()
>>   {
>> +	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.

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.

-- 
Martin Doucha   mdoucha@suse.cz
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-12-17 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 17:30 [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Martin Doucha
2025-12-16 17:30 ` [LTP] [PATCH 2/2] cpuset_memory: Fix race in multinode subtests Martin Doucha
2025-12-17  7:08   ` Petr Vorel
2025-12-17  7:13     ` Andrea Cervesato via ltp
2025-12-17  9:39       ` Cyril Hrubis
2025-12-17  7:12 ` [LTP] [PATCH 1/2] cpuset_memory: Print basic subtest descriptions Petr Vorel
2025-12-17 10:26   ` Martin Doucha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox