> On Aug. 3, 2015, 11:36 p.m., Michael Park wrote:
> > src/tests/containerizer/memory_test_helper.cpp, line 81
> > <https://reviews.apache.org/r/37065/diff/1/?file=1028301#file1028301line81>
> >
> >     What's the significance in the order in which these are called? I 
> > would've expected something like:
> >     
> >     ```
> >       // Make sure that all pages that are going to be mapped into the
> >       // address space of this process become unevictable. This is needed
> >       // for testing cgroup oom killer.
> >     #ifdef __APPLE__
> >       if (mlock(rss, size.bytes()) != 0)
> >     #else
> >       if (mlockall(MCL_FUTURE) != 0)
> >     #endif
> >       {
> >         return ErrnoError("Failed to make pages to be mapped unevictable");
> >       }
> >     ```
> 
> Artem Harutyunyan wrote:
>     The mlockall(MCL_FUTURE) has to be called before the memory allocation is 
> made (because it affects future allocations), whereas mlock() is called for 
> already allocated pages. I could probably change mlockall(MCL_FUTURE) to 
> mlockall(MCL_CURRENT) in your snippet and make it work that way. I'll test to 
> verify and will update the patch accordingly. Thanks!
> 
> James Peach wrote:
>     IMHO it would be better to add an autoconf check for ```mlockall``` 
> availability that to check ```__APPLE__```.
> 
> Michael Park wrote:
>     @jpeach: Do you mean we should fail to configure if `mlockall` is not 
> available? If we did that, we wouldn't be able to compile on OS X though.
> 
> James Peach wrote:
>     In autoconf, do ```AC_CHECK_FUNC(mlockall)```, then make this code 
> conditional on ```#if HAVE_MLOCKALL```.
> 
> Michael Park wrote:
>     Ah I see, great! I agree that's better since there may be other platforms 
> aside from OS X that don't support `mlockall`. @hartem: what do you think?
> 
> Artem Harutyunyan wrote:
>     I refactored following MPark's suggestion, however using 
> AC_CHECK_FUNC(mlockall) did not work, because the function is present on OSX, 
> it just prints the error message instead of actually locking memory pages.

Actually, I was too hopeful too quickly :-). I had to revert the 
mlockall(MCL_CURRENT) change becasue it broke the OOM killer test on Ubuntu.


- Artem


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37065/#review94001
-----------------------------------------------------------


On Aug. 5, 2015, 10:14 p.m., Artem Harutyunyan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37065/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2015, 10:14 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Michael Park.
> 
> 
> Bugs: MESOS-3197
>     https://issues.apache.org/jira/browse/MESOS-3197
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   src/tests/containerizer/memory_test_helper.cpp 
> 5e40b747f4266e7532baf8fd02ea5db0955124d2 
> 
> Diff: https://reviews.apache.org/r/37065/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Artem Harutyunyan
> 
>

Reply via email to