about overcommit_memory
2014-08-22 13:03
357 查看
Since 2.1.27 there are a sysctl
proc file
values 1: do overcommit, and 0 (default): don't. Unfortunately, this does not allow you to tell the kernel to be more careful, it only allows you to tell the kernel to be less careful. With
to 1 every
succeed. When set to 0 the old heuristics are used, the kernel still overcommits.
Since 2.5.30 the values are: 0 (default): as before: guess about how much overcommitment is reasonable, 1: never refuse any
2: be precise about the overcommit - never commit a virtual address space larger than swap space plus a fraction
the physical memory. Here
default 50) is another user-settable parameter. It is possible to set
values larger than 100. (See also
After
all three demo programs were able to obtain 498 MiB on this 2.6.8.1 machine (256 MiB, 539 MiB swap, lots of other active processes), very satisfactory.
However, without swap, no more processes could be started - already more than half of the memory was committed. After
all three demo programs were able to obtain 34 MiB. (Exercise: solve two equations with two unknowns and conclude that main memory was 250 MiB, and the other processes took 166 MiB.)
One can view the currently committed amount of memory in
in the field
VM_OVERCOMMIT_MEMORYand
proc file
/proc/sys/vm/overcommit_memorywith
values 1: do overcommit, and 0 (default): don't. Unfortunately, this does not allow you to tell the kernel to be more careful, it only allows you to tell the kernel to be less careful. With
overcommit_memoryset
to 1 every
malloc()will
succeed. When set to 0 the old heuristics are used, the kernel still overcommits.
Going in the right direction
Since 2.5.30 the values are: 0 (default): as before: guess about how much overcommitment is reasonable, 1: never refuse any malloc(),
2: be precise about the overcommit - never commit a virtual address space larger than swap space plus a fraction
overcommit_ratioof
the physical memory. Here
/proc/sys/vm/overcommit_ratio(by
default 50) is another user-settable parameter. It is possible to set
overcommit_ratioto
values larger than 100. (See also
Documentation/vm/overcommit-accounting.)
After
1 | # echo 2 > /proc/sys/vm/overcommit_memory |
However, without swap, no more processes could be started - already more than half of the memory was committed. After
1 | # echo 80 > /proc/sys/vm/overcommit_ratio |
One can view the currently committed amount of memory in
/proc/meminfo,
in the field
Committed_AS.
相关文章推荐
- 有关linux下redis overcommit_memory的问题(转)
- overcommit_memory
- sysctl 中 vm.overcommit_memory 的含义
- 有关linux下redis overcommit_memory的问题
- linux 内存分配限制,overcommit_memory 2
- overcommit_memory
- MongoDB numa系列问题三:overcommit_memory和zone_reclaim_mode
- 有关linux下redis overcommit_memory的问题
- linux-overcommit_memory
- overcommit_memory
- linux-overcommit_memory
- 理解overcommit_memory
- 有关linux下redis overcommit_memory的问题
- overcommit_memory
- 又一次内存分配失败(关于overcommit_memory)
- 转载:理解LINUX的MEMORY OVERCOMMIT
- overcommit_memory 内核参数
- overcommit_memory 内核参数
- overcommit_memory
- 有关linux下redis overcommit_memory的问题