Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – CGroups内存限制不起作用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

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

然后我查了/ proc / cgroups:

# cat /proc/cgroups
#subsys_name    hierarchy       num_cgroups     enabled
cpuset  2       3       1
cpu     3       3       1
cpuacct 3       3       1
memory  0       1       0
devices 4       3       1
freezer 5       3       1
net_cls 6       3       1
blkio   7       3       1
perf_event      8       3       1
net_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=0
GRUB_TIMEOUT=5
GRUB_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内存限制不起作用所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
猜你在找的Linux相关文章