Thread (18 messages) 18 messages, 3 authors, 2021-12-21

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

From: Petr Vorel <pvorel@suse.cz>
Date: 2021-12-21 08:33:28

Hi Li,
quoted
quoted
+     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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help