We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在书中通过sudo sh -c "echo "100m " > memory.limit_in_bytes " 将内存最大限制为100m, 然后执行了 stress --vm-bytes 200m --vm-keep -m 1 后 在top中看到了内存被限制到了100m.
sudo sh -c "echo "100m " > memory.limit_in_bytes "
stress --vm-bytes 200m --vm-keep -m 1
但是我理解当申请的内存超过限制的内存时,不是直接会被kill掉? 下面是我执行后的结果,不是太明白书中的运行后可以看到内存被限制而不是直接提示失败?
stress: info: [4] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd stress: FAIL: [4] (415) <-- worker 5 got signal 9 stress: WARN: [4] (417) now reaping child worker processes stress: FAIL: [4] (421) kill error: No such process stress: FAIL: [4] (451) failed run completed in 0s 2020/03/07 15:52:22 exit status 1
The text was updated successfully, but these errors were encountered:
@blacklad
你可以了解一下这个文件:
root@ubuntu:/sys/fs/cgroup/memory# cat memory.oom_control oom_kill_disable 0 under_oom 0
这个文件里面包含了一个控制是否为当前 cgroup 启动 OOM-killer 的标识。如果写0到这个文件,将启动OOM-killer,当内核无法给进程分配足够的内存时,将会直接kill掉该进程;如果写1到这个文件,表示不启动OOM-killer,当内核无法给进程分配足够的内存时,将会暂停该进程直到有空余的内存之后再继续运行;同时,memory.oom_control还包含一个只读的under_oom字段,用来表示当前是否已经进入oom状态,也即是否有进程被暂停了。
Sorry, something went wrong.
@blacklad 补充一下,还有这个文件:
memory.swappiness
No branches or pull requests
在书中通过
sudo sh -c "echo "100m " > memory.limit_in_bytes "
将内存最大限制为100m,然后执行了
stress --vm-bytes 200m --vm-keep -m 1
后 在top中看到了内存被限制到了100m.但是我理解当申请的内存超过限制的内存时,不是直接会被kill掉?
下面是我执行后的结果,不是太明白书中的运行后可以看到内存被限制而不是直接提示失败?
The text was updated successfully, but these errors were encountered: