<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 Wed, Jul 10, 2019 at 9:00 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> > iteration, the mmap() will be failed with ENOMEM(since we only have 1 huge<br>
> > page in /proc/.../nr_hugepages).<br>
> ><br>
> <br>
> Sentence correction:<br>
> It is not "only have 1 huge page in nr_hugepages", I mixed this test<br>
> with another case, sorry about that.<br>
> <br>
> But the justification is the same, we don't have enough memory for the<br>
> parent does mmap(..., MAP_HUGETLB) in a new loop.<br>
<br>
I guess I get it now, if we attempt to continue after EBUSY we unmap()<br>
the memory but that unmap() will happen asynchronously because the<br>
migration is in progress and we hit ENOMEM just in the next iteration of<br>
the loop.<br>
<br>
Should we then attempt to retry the mmap() on ENOMEM as well, ideally<br>
with exponential backoff?<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Not very sure if that worth to do.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Unfortunately we cannot reuse the TST_RETRY_FUNC() as it is because it<br>
exits the test with TBROK on failure, we need a function that actually<br>
returns the last function return value on timeout.<br></blockquote><div> </div><div><div class="gmail_default" style="font-size:small">Yes, we could define a new TST_WAIT_FUNC() to return mmap() returned value on timeout, but it seems hard to give an expected return(ERET) value for that function, in this case, we could define the ERET as addr since we know it, but for most situations, we can't make sure what is the address being returned. Once the returned address is not equal ERET, then it will retry the mmap() and do not unmmap() the previous memory. That will be terrible.</div></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>