<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 14, 2021 at 12:15 AM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Protecting the test harness is a bad idea because oom_score_adj is<br>
> inherited by child processes and it'll affect other tests as well. Given<br>
> the nature of OOM tests, I'd rather not assume that the protection will<br>
> be properly removed at the end.<br>
<br>
This should be easily doable since the test library forks right before<br>
it executes the test, so we have a single place where the score has to<br>
be reset.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I think so. And we can even export the function as global to</div><div class="gmail_default" style="font-size:small">make it easy to enable/cancel the OOM protection for any </div><div class="gmail_default" style="font-size:small">process at any time we wanted. Then, just resetting the child</div><div class="gmail_default" style="font-size:small">process oom_score_adj to 0 can avoid to inherited from the</div><div class="gmail_default" style="font-size:small">lib-process score as well.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">e.g.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> void tst_enable_oom_protection(pid_t pid)</div><div class="gmail_default" style="font-size:small"> void tst_cancel_oom_protection(pid_t pid)</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
For new library tests there is a process that does nothing but waits for<br>
the actuall test pid to finish and kills it on timeout. It really makes<br>
sense to protect this exact process and maybe even mlock() it into the<br>
memory.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">+1</div><div class="gmail_default" style="font-size:small"><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>