[LTP] [PATCH 2/3] ltp: enable OOM protection for main and test harness process

Martin Doucha mdoucha@suse.cz
Thu Dec 16 10:50:34 CET 2021


Hi,

On 16. 12. 21 4:41, Li Wang wrote:
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index ce2b8239d..f3ae48240 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1441,11 +1441,15 @@ static int fork_testrun(void)
>  
>  	SAFE_SIGNAL(SIGINT, sigint_handler);
>  
> +	tst_enable_oom_protection(getppid());

this is exactly what you should *NOT* do because then the OOM protection
will also be inherited by all non-LTP processes executed by the same
shell (or whatever the parent process is).

> +	tst_enable_oom_protection(getpid());
> +
>  	test_pid = fork();
>  	if (test_pid < 0)
>  		tst_brk(TBROK | TERRNO, "fork()");
>  
>  	if (!test_pid) {
> +		tst_cancel_oom_protection(getpid());
>  		SAFE_SIGNAL(SIGALRM, SIG_DFL);
>  		SAFE_SIGNAL(SIGUSR1, SIG_DFL);
>  		SAFE_SIGNAL(SIGINT, SIG_DFL);
> 


-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list