You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Anton Lindström <an...@alley.se> on 2014/08/05 18:05:30 UTC

Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

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

Review request for mesos.


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs
-----

  src/linux/cgroups.hpp c571e915fec461485d2015f58e6e828b00ea089a 
  src/linux/cgroups.cpp ccb86cf172c3c97513b16b90756d7bc12aad278f 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8d1e35a1acdb3beb03a91cfd734a59417657b20 
  src/slave/flags.hpp 5ea2f38df5a777f275136b7849d77cb461a32f8d 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Mesos ReviewBot <de...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review49707
-----------------------------------------------------------


Bad patch!

Reviews applied: [24316]

Failed command: git apply --index 24316.patch

Error:
 error: patch failed: src/linux/cgroups.hpp:430
error: src/linux/cgroups.hpp: patch does not apply
error: patch failed: src/linux/cgroups.cpp:1899
error: src/linux/cgroups.cpp: patch does not apply
error: patch failed: src/slave/containerizer/isolators/cgroups/mem.cpp:279
error: src/slave/containerizer/isolators/cgroups/mem.cpp: patch does not apply


- Mesos ReviewBot


On Aug. 5, 2014, 4:05 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2014, 4:05 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp c571e915fec461485d2015f58e6e828b00ea089a 
>   src/linux/cgroups.cpp ccb86cf172c3c97513b16b90756d7bc12aad278f 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8d1e35a1acdb3beb03a91cfd734a59417657b20 
>   src/slave/flags.hpp 5ea2f38df5a777f275136b7849d77cb461a32f8d 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review49817
-----------------------------------------------------------



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment87175>

    This should fit in one line



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87194>

    Hum, here is what I think is the right way to do this:
    
    1) Added a field 'limitSwap' in the isolator class.
    
    2) In ::create(), based on the flag.limit_swap and whether "memory.memsw.limit_in_bytes" is available (by calling cgroups::memory::memsw_limit_in_bytes() on cgroups_root), set 'limitSwap' field accordingly (when create the isolator). More specifically:
      - if flag.limit_swap == false, set limitSwap to false
      - if flag.limit_swap == true but memsw_limit_in_bytes is not available, return error on ::create
      - if flag.limit_swap = true and memsw_limit_in_bytes is available, set limitSwap to true
    
    3) If 'limitSwap == true', we always read/write memsw_limit_in_bytes. Otherwise, we always read/write limit_in_bytes.



src/slave/flags.hpp
<https://reviews.apache.org/r/24316/#comment87178>

    Add a period at the end of a sentence.


- Jie Yu


On Aug. 6, 2014, 6:52 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 6, 2014, 6:52 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review50002
-----------------------------------------------------------

Ship it!


Please update the diff. I'll get it committed tomorrow! Thanks!


src/linux/cgroups.hpp
<https://reviews.apache.org/r/24316/#comment87486>

    Ditto BenM's comment, we may want to return Try<bool> here (false means the memsw does not exist like when swap is disabled).



src/slave/containerizer/isolators/cgroups/mem.hpp
<https://reviews.apache.org/r/24316/#comment87487>

    s/static bool/const bool/
    
    ALso, move it below 'const string hierarchy'.



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87488>

    Do not use static field. What if in the tests, we want to create two memory isolators , one of them has swap turned on and the other has swap turned off?



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87493>

    return Error("'memory.memsw.limit_in_bytes' is not available");



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87489>

    process::Owned<IsolatorProcess> process(
        new CgroupsMemIsolatorProcess(flags, hierarchy.get(), limitSwap));



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87492>

    return Failure("'memory.memsw.limit_in_bytes' is not available");



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87490>

    To be consistent with below:
    
    return Failure(
        "Failed to set 'memory.memsw.limit_in_bytes': " + write.error());



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87494>

    return Failure("'memory.memsw.limit_in_bytes' is not available");



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87491>

    indent 4 spaces (instead of 2).



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87495>

    What if 'limit.isNone()?'


- Jie Yu


On Aug. 7, 2014, 9:09 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 7, 2014, 9:09 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review50004
-----------------------------------------------------------



src/slave/flags.hpp
<https://reviews.apache.org/r/24316/#comment87496>

    fly by review:
    
    move this flag below cgroups_enable_cfs flag.
    
    also, s/limit_swap/cgroups_limit_swap/


- Vinod Kone


On Aug. 7, 2014, 9:09 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 7, 2014, 9:09 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --cgroups_limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review50129
-----------------------------------------------------------


I've committed this patch. Please mark it as submitted.

- Jie Yu


On Aug. 10, 2014, 11:55 a.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 10, 2014, 11:55 a.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 26dcb3d8c948bd4b3f203f0fc4dd415f5697980f 
>   src/linux/cgroups.cpp 47be0eff4ae1119c2da21e557e512e158b2afae0 
>   src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --cgroups_limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 10, 2014, 11:55 a.m.)


Review request for mesos.


Changes
-------

Updated based on comments and have run tests successfully on a machine with memsw. 

Let me know if there's anything else. Thank you so much for all the help!


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs (updated)
-----

  src/linux/cgroups.hpp 26dcb3d8c948bd4b3f203f0fc4dd415f5697980f 
  src/linux/cgroups.cpp 47be0eff4ae1119c2da21e557e512e158b2afae0 
  src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --cgroups_limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review50039
-----------------------------------------------------------


Looks good! Can you do me one favor, can you test it on a machine with memsw turned on and run out tests with --cgroups_limit_swap set to true?


src/slave/containerizer/isolators/cgroups/mem.hpp
<https://reviews.apache.org/r/24316/#comment87550>

    We don't use const ref for primitive types
    
    s/const bool&/bool/



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87551>

    indent 2 spaces please.


- Jie Yu


On Aug. 8, 2014, 10:42 a.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 8, 2014, 10:42 a.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --cgroups_limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 8, 2014, 10:42 a.m.)


Review request for mesos.


Summary (updated)
-----------------

Use memory.memsw.limit_in_bytes in cgroup mem isolator with --cgroups_limit-swap


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs
-----

  src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
  src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
  src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 8, 2014, 10:40 a.m.)


Review request for mesos.


Changes
-------

Diff updated, please let me know if I can improve anything else. Thanks for all the help and patience!


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs (updated)
-----

  src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
  src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
  src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 7, 2014, 9:09 p.m.)


Review request for mesos.


Changes
-------

I've updated the code from your comments. Thank you so much for all the help! 


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs (updated)
-----

  src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
  src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
  src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review49925
-----------------------------------------------------------


Getting close! Thanks Anton!


src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87368>

    Make that a field member of CgroupsMemIsolatorProcess



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87369>

    You don't need to check cgroups::memory::memsw_limit_in_bytes if flags.limit_swap is false, right? So here is what I would do:
    
    bool limitSwap = false;
    
    if (flags.limit_swap) {
      Result<Bytes> check = cgroups::memory::memsw_limit_in_bytes(...);
      if (check.isError()) {
        return Error(...);
      } else if (check.isNone()) {
        return Error(...);
      }
      
      limitSwap = true;
    }



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87385>

    At most one empty line here.



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87376>

    Move this down right above 'if (limitSwap)'.
    
    Also, consider naming it as 'currentLimit' and use _ prefix for that returned from cgroups::memory::...



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87378>

    Result<Bytes> _currentLimit =
      cgroups::memory::memsw_limit_in_bytes(hierarchy, info->cgroup);



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87377>

    what about currentLimit.isNone()?
    
    if (_currentLimit.isError()) {
    } else if (_currentLimit.isNone()) {
    }
    
    currentLimit = _currentLimit.get();



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87379>

    Ditto.



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87380>

    s/writeMemSw/write/



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87381>

    Again, what if write.isNone()?



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87382>

    Align it properly:
    
    return Failure(
        "..." + write.error());



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87383>

    Try<Nothing> write = ...



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87384>

    Kill blank line here.



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87372>

    Align '<<':
    
    LOG(ERROR) << "..."
               << limit.error();



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87374>

    Be consistent:
    
    Try<Bytes> limit =
      cgroups::memory::limit_in_bytes(hierarchy, info->cgroup);



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment87371>

    Align '<<':
    
    LOG(ERROR) << "..."
               << limit.error();


- Jie Yu


On Aug. 7, 2014, 2:56 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 7, 2014, 2:56 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 7, 2014, 2:56 p.m.)


Review request for mesos.


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs (updated)
-----

  src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
  src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Anton Lindström <an...@alley.se>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/
-----------------------------------------------------------

(Updated Aug. 6, 2014, 6:52 p.m.)


Review request for mesos.


Changes
-------

Updated to reflect the comments. Thank you so much for your time, Jie Yu!


Bugs: MESOS-1662
    https://issues.apache.org/jira/browse/MESOS-1662


Repository: mesos-git


Description
-------

Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.

Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.


Diffs (updated)
-----

  src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
  src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
  src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
  src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 

Diff: https://reviews.apache.org/r/24316/diff/


Testing
-------

make check


Thanks,

Anton Lindström


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Ben Mahler <be...@gmail.com>.

> On Aug. 5, 2014, 5:37 p.m., Jie Yu wrote:
> > src/linux/cgroups.cpp, line 1925
> > <https://reviews.apache.org/r/24316/diff/1/?file=652057#file652057line1925>
> >
> >     Let's not put the fall-back logic into this utility function. The fall-back logic should be done at a higher level (i.e., in the memory isolator). How about returning a Result<Bytes> for this function:
> >     
> >     isSome() -> the value of memsw.limit_in_bytes
> >     isNone() -> memory.memsw.limit_in_bytes is not supported
> >     isError() -> other errors.

We've avoiding ever having a Result<Nothing> return type because what is the difference between None() and Some(Nothing())? Seems very confusing?


- Ben


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


On Aug. 7, 2014, 9:09 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 7, 2014, 9:09 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp 9dfba6eb9059728386d053f8c2e92edab0caa295 
>   src/linux/cgroups.cpp 39a4874ee0030110d7a61f1b73653af116d66549 
>   src/slave/containerizer/isolators/cgroups/mem.hpp 6869ed4a9fa9a1a719e695ac83aeec88ead0efc0 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8160efc4f5baa06470a8a3c774bf97d5b9e83cc 
>   src/slave/flags.hpp 841de2364085c66e4272734d5b11dbf8efa845a5 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>


Re: Review Request 24316: Use memory.memsw.limit_in_bytes in cgroup mem isolator with --limit-swap

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24316/#review49621
-----------------------------------------------------------



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment86848>

    Hum, this diff seems to be problematic. Have you rebased to master?



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment86849>

    Let's not put the fall-back logic into this utility function. The fall-back logic should be done at a higher level (i.e., in the memory isolator). How about returning a Result<Bytes> for this function:
    
    isSome() -> the value of memsw.limit_in_bytes
    isNone() -> memory.memsw.limit_in_bytes is not supported
    isError() -> other errors.



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment86850>

    return None();



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment86851>

    Similarly, return Result<Nothing> here.



src/linux/cgroups.cpp
<https://reviews.apache.org/r/24316/#comment86852>

    return None()



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment86854>

    No need to include this headers as 'Flags' is already in function signatures.



src/slave/containerizer/isolators/cgroups/mem.cpp
<https://reviews.apache.org/r/24316/#comment86855>

    This doesn't seem to be right... What's the purpose of calling memsw_limit_in_bytes and save the return value to a temp variable inside the if scope?



src/slave/flags.hpp
<https://reviews.apache.org/r/24316/#comment86853>

    Set default to true ...


- Jie Yu


On Aug. 5, 2014, 4:05 p.m., Anton Lindström wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24316/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2014, 4:05 p.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: MESOS-1662
>     https://issues.apache.org/jira/browse/MESOS-1662
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Changed memory.limit_in_bytes to memory.memsw.limit_in_bytes where memory is limited. This makes Mesos limit both memory and swap as described in the Jira ticket.
> 
> Using --limit-swap, it's possible to use memory.memsw.limit_in_bytes. If it doesn't exist it will fallback on memory.limit_in_bytes.
> 
> 
> Diffs
> -----
> 
>   src/linux/cgroups.hpp c571e915fec461485d2015f58e6e828b00ea089a 
>   src/linux/cgroups.cpp ccb86cf172c3c97513b16b90756d7bc12aad278f 
>   src/slave/containerizer/isolators/cgroups/mem.cpp e8d1e35a1acdb3beb03a91cfd734a59417657b20 
>   src/slave/flags.hpp 5ea2f38df5a777f275136b7849d77cb461a32f8d 
> 
> Diff: https://reviews.apache.org/r/24316/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Anton Lindström
> 
>