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

Petr Vorel pvorel@suse.cz
Wed Dec 17 08:08:31 CET 2025


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


More information about the ltp mailing list