From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/3] lib: add functions to adjust oom score
Date: Thu, 16 Dec 2021 08:49:54 +0100 [thread overview]
Message-ID: <YbrvolVYj7io6rOm@pevik> (raw)
In-Reply-To: <20211216034125.255907-1-liwang@redhat.com>
Hi Li,
> This introduces function to LTP for adjusting the oom_score_adj of
> target process, which may be helpful in OOM tests to prevent kernel
> killing the main or lib process during test running.
very good idea.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
> The exported global tst_enable_oom_protection function can be used
> at anywhere you want to protect, but please remember that if you
> do enable protection on a process($PID) that all the children will
> inherit its score and be ignored by OOM Killer as well. So that's
> why tst_cancel_oom_protection is recommended to combination in use.
BTW deliberately not documenting it as it should not be commonly
used in tests? Also although oom_score_adj inheritance should be known to
person who will want to add it somewhere, I'd move it from commit message to
source code (into header docs or or C API doc).
> +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) {
> + tst_res(TINFO, "Warning: oom_score_adj is not exist");
nit: IMHO "does not exist" or just "not exist"
...
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-12-16 7:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 8:03 [LTP] [RFC] enable OOM protection for the library and test process? Li Wang
2021-12-13 9:32 ` Jan Stancek
2021-12-13 10:18 ` Li Wang
2021-12-13 15:08 ` Cyril Hrubis
2021-12-13 16:06 ` Martin Doucha
2021-12-13 16:15 ` Cyril Hrubis
2021-12-13 16:59 ` Martin Doucha
2021-12-14 6:46 ` Li Wang
2021-12-14 6:31 ` Li Wang
2021-12-16 3:41 ` [LTP] [PATCH 1/3] lib: add functions to adjust oom score Li Wang
2021-12-16 3:41 ` [LTP] [PATCH 2/3] ltp: enable OOM protection for main and test harness process Li Wang
2021-12-16 7:55 ` Petr Vorel
2021-12-16 9:50 ` Martin Doucha
2021-12-17 1:50 ` Li Wang
2021-12-16 3:41 ` [LTP] [PATCH 3/3] oom: enable OOM protection for mem lib process Li Wang
2021-12-16 7:57 ` Petr Vorel
2021-12-16 7:49 ` Petr Vorel [this message]
2021-12-17 2:02 ` [LTP] [PATCH 1/3] lib: add functions to adjust oom score Li Wang
2021-12-17 8:25 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbrvolVYj7io6rOm@pevik \
--to=pvorel@suse.cz \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox