[LTP] [PATCH 1/1] tst_pids.c: fix fork failure on small memory systems

Petr Vorel pvorel@suse.cz
Tue Feb 7 14:42:22 CET 2023


Hi Leo,

> Running syscalls/msgstress03 on a system with less than ~1 GB of RAM fails:

> 	msgstress03    1  TFAIL  :  msgstress03.c:163:  Fork failed (may be OK if under stress)

> The reason is that besides /proc/sys/kernel/pid_max, /proc/sys/kernel/threads-max
> is another factor determining how many processes a system could create.

> Use the smaller number between pid_max and threads-max as the nprocs.

Makes sense.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

BTW IMHO it'd be better to rewrite
f = popen("ps -eT | wc -l", "r");
to list count of /proc/[0-9]*/ in plain C (TODO for us).

Kind regards,
Petr


More information about the ltp mailing list