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

Leo Liang ycliang@andestech.com
Thu Feb 9 14:35:39 CET 2023


Hi Petr,

On Tue, Feb 07, 2023 at 02:42:22PM +0100, Petr Vorel wrote:
> 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).
>

Thanks for the review!
I could send a v2 to add this as well.

Best regards,
Leo

> Kind regards,
> Petr


More information about the ltp mailing list