[LTP] [PATCH v3 1/3] lib: add functions to adjust oom score
Petr Vorel
pvorel@suse.cz
Tue Dec 21 09:33:13 CET 2021
Hi Li,
> > > + 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.
> Good catch, I would add a 'W_OK' checking and skip the setting with
> a reminder message if run without root.
> how about this?
> if (access(score_path, W_OK) == -1) {
> tst_res(TINFO, "Warning: %s cannot be accessed for writing,
> please check if test run with root user.",
> score_path);
> return
> }
No, value < 0 obviously requires root, thus access() check is not enough.
Try echo -1 > /proc/$$/oom_score_adj
Kind regards,
Petr
More information about the ltp
mailing list