[LTP] [PATCH v3 1/3] lib: add functions to adjust oom score

Petr Vorel pvorel@suse.cz
Mon Dec 20 19:34:04 CET 2021


Hi Li,

>     v2 --> v3
>     	* rename to tst_disable_oom_protection
>     	* support set PID as 0 to protect current process

> +static void set_oom_score_adj(pid_t pid, int value)
> +{
> +	int val;
> +	char score_path[64];
> +
> +	if (access("/proc/self/oom_score_adj", F_OK) == -1) {
We need to check here also /proc/PID/oom_score_adj, i.e. score_path.

Otherwise tests without root fail fail.
lib/tst_memutils.c:111: TBROK: Failed to close FILE '/proc/26980/oom_score_adj': EACCES (13)

Kind regards,
Petr



More information about the ltp mailing list