如何为linux CGroup提供更多内存? [英] How do I give more memory to a linux CGroup?

查看:106
本文介绍了如何为linux CGroup提供更多内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各位大家好,我正在尝试使用Linux的内核功能为一组进程创建一个简单的容器:CGroups。我设法创建了一个组并正确地将 memory.limit_in_bytes memory.memsw.limit_in_bytes 参数设置为给定的限制。

我的虚拟程序只是在infite循环中分配内存并检查它是否成功(内存未被释放)。我已经调整了控制组以禁用OOM,当进程达到内存限制时它就会冻结(这没关系),但我想动态更改内存限制,以便进程可以恢复并继续使用更多可用内存。

当达到内存限制时,我无法更改内存子系统的限制值,只是回显一个新值,我能想到的唯一解决方案是用新的创建一个新组限制并将进程移动到此新组并删除旧组。如果有人知道我怎么能做到这一点请告诉我:P。在此先感谢,抱歉我的英语不好。

Hello everybody, I am trying to make a simple container for a group of processes using the Linux's kernel feature: CGroups. I managed to create a group and properly set the memory.limit_in_bytes and memory.memsw.limit_in_bytes parameters to a given limit.
My dummy program just allocates memory in an infite loop and checks if it succeeded or not (the memory is not freed). I've tuned the control group to disable the OOM, and when the process reaches the memory limit it just freezes (thats is ok), but I want to change the memory limit dynamically so the process can resume and continue working with more available memory.
When the memory limit is reached, I can not change the limit values for the memory subsystem just echoing a new value and the only "solution" I can think of is creating a new group with the new limits and move the processes to this new group and delete the old group. If anybody knows how can I accomplish this please tell me :P. Thanks in advance and sorry for my bad English.

推荐答案

这篇关于如何为linux CGroup提供更多内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆