# Adding support for cgroups

**URL:** <https://community.openpbs.org/t/adding-support-for-cgroups/172>\
**Category:** Developers\
**Created:** [July 18, 2016, 11:52pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172 "2016-07-18T23:52:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/jon/32/23_2.png) [@jon](https://community.openpbs.org/u/jon)\
**Post date:** [July 18, 2016, 11:52pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/1 "2016-07-18T23:52:31Z")

</div>

This is to inform the community work being done to support cgroups. Details may be found here: [https://pbspro.atlassian.net/wiki/display/PD/PP-325+Support+Cgroups](https://pbspro.atlassian.net/wiki/display/PD/PP-325+Support+Cgroups)

Please feel free to provide feedback on this topic.

---

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [July 20, 2016, 10:47am UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/2 "2016-07-20T10:47:01Z")

</div>

Hi jon,  
I want to try out cgroups but I miss the [cgroups.py](http://cgroups.py) file. Could you please provide an example or give me a hint?

---

<div class="post-metadata">

**Author:** ![mkaro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/mkaro/32/85_2.png) [@mkaro](https://community.openpbs.org/u/mkaro)\
**Post date:** [July 20, 2016, 3:48pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/3 "2016-07-20T15:48:34Z")

</div>

We are in the process of reviewing the merge. The files should be available soon.

---

<div class="post-metadata">

**Author:** ![jon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/jon/32/23_2.png) [@jon](https://community.openpbs.org/u/jon)\
**Post date:** [July 26, 2016, 2:35pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/4 "2016-07-26T14:35:17Z")

</div>

vchlum,

I have submitted a pull request to merge the cgroup work into open source. If you would like early access to it you can go look at the pull request and copy the pbs\_cgroups.json and pbs\_cgroups.py file.

For some help on getting started please refer to [https://pbspro.atlassian.net/wiki/display/PD/PP-325+Support+Cgroups](https://pbspro.atlassian.net/wiki/display/PD/PP-325+Support+Cgroups)

If you give it a try, I would be interested in your feedback.

Jon

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [July 26, 2016, 4:09pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/5 "2016-07-26T16:09:51Z")

</div>

And we would love early comments on the feature and the code itself from everybody. Please feel free to review the code and let us know what you think about it.

Regards,  
Subhasis

---

<div class="post-metadata">

**Author:** ![vchlum](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/vchlum/32/93_2.png) [@vchlum](https://community.openpbs.org/u/vchlum)\
**Post date:** [July 27, 2016, 8:33am UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/6 "2016-07-27T08:33:48Z")

</div>

Thank you for the files. It seems to work for me ok (tested on Debian 8).

Checking the get\_vmem\_on\_node I discovered a typo.  
On line pbs\_cgroup.py:1341:  
`percent_reserve = config['cgroup']['memsw']['reserve_memory']`  
should be:  
`percent_reserve = config['cgroup']['memsw']['percent_reserve']`

Percent reserve is also not mentioned on the wiki page.

---

<div class="post-metadata">

**Author:** ![jon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/jon/32/23_2.png) [@jon](https://community.openpbs.org/u/jon)\
**Post date:** [August 16, 2016, 4:02am UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/7 "2016-08-16T04:02:14Z")

</div>

vchlum,

You are correct that I did not mention percent\_reserve. When we first looked at this we decided to do a percent\_reserve as a way to reserve some RAM for processes other than PBS (i.e. the OS). However, this did not give us a very reliable number especially on systems where multiple types of nodes with different amounts of memory. I decided to use reserve\_memory so that I could always reserve a specific amount. I will look into this and clean it up as time allows.

Thanks for you feedback.

---

<div class="post-metadata">

**Author:** ![mkaro](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/mkaro/32/85_2.png) [@mkaro](https://community.openpbs.org/u/mkaro)\
**Post date:** [August 16, 2016, 7:16pm UTC](https://community.openpbs.org/t/adding-support-for-cgroups/172/8 "2016-08-16T19:16:02Z")

</div>

Both percent\_reserve and reserve\_memory are valid options, though I see that percent\_reserve was removed from the default configuration file. At the moment, it appears these are mutually exclusive. I believe they should be additive. There will be some changes to the hook over the next couple weeks, so please keep your feedback coming!
