linux – CGroups内存限制不起作用

linux – CGroups内存限制不起作用,第1张

概述我试图使用CGroups限制LXC容器的内存使用,但我无法限制内存. # lxc-cgroup -n maxdaniel981 memory.limit_in_bytes 134217728lxc_container: failed to assign '134217728' value to 'memory.limit_in_bytes' for 'maxdaniel981' 然后我查了/ p 我试图使用CGroups限制LXC容器的内存使用,但我无法限制内存.
# lxc-cgroup -n maxdanIEl981 memory.limit_in_bytes 134217728lxc_container: Failed to assign '134217728' value to 'memory.limit_in_bytes' for 'maxdanIEl981'

然后我查了/ proc / cgroups:

# cat /proc/cgroups#subsys_name    hIErarchy       num_cgroups     enabledcpuset  2       3       1cpu     3       3       1cpuacct 3       3       1memory  0       1       0devices 4       3       1freezer 5       3       1net_cls 6       3       1blkio   7       3       1perf_event      8       3       1net_prio        6       3       1

它看起来像cgroups_memory被禁用,但我在/ etc / default / grub中启用了内核标志并使用update-grub更新了grub

# cat /etc/default/grub# If you change this file,run 'update-grub' afterwards to update# /boot/grub/grub.cfg.# For full documentation of the options in this file,see:#   info -f grub -n 'Simple configuration'GRUB_DEFAulT=0GRUB_TIMEOUT=5GRUB_disTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`GRUB_CMDliNE_liNUX_DEFAulT="cggroup_enable=memory swapaccount=1"GRUB_CMDliNE_liNUX="cggroup_enable=memory swapaccount=1"

CGroup安装在/ etc / fstab中就像这样;

cgroup        /sys/fs/cgroup  cgroup  defaults        0       0

有人可以帮我解决这个问题吗?我使用的是Debian JessIE,我的内核版本是3.16.0-4-amd64.

解决方法 你的 GRUB configuration中有一个小错字; cgroup不是cggroup应该做的伎俩:
GRUB_CMDliNE_liNUX_DEFAulT="cgroup_enable=memory swapaccount=1"
总结

以上是内存溢出为你收集整理的linux – CGroups内存限制不起作用全部内容,希望文章能够帮你解决linux – CGroups内存限制不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1036406.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存