linux overcommit flag
linux中有一个overcomit的配置,这个配置关系到进程在过多申请memory资源的时候,系统的表现(启发式允许,不检查,or 阻止)
/proc/sys/vm/overcommit_memory
This file contains the kernel virtual memory accounting mode.
Values are: : heuristic overcommit (this is the default)
: always overcommit, never check
: always check, never overcommit In mode , calls of mmap() with MAP_NORESERVE are not
checked, and the default check is very weak, leading to the
risk of getting a process "OOM-killed". In mode (available since Linux 2.6), the total virtual
address space that can be allocated (CommitLimit in /proc/mem‐
info) is calculated as CommitLimit = (total_RAM - total_huge_TLB) *
overcommit_ratio / + total_swap
详细的理解可以参见这个博客: http://linuxperf.com/?p=102
在实际项目中,如果机器是跑redis的一般都会把overcomit开成1 (https://redis.io/topics/faq#background-saving-fails-with-a-fork-error-under-linux-even-if-i-have-a-lot-of-free-ram)
Short answer: echo > /proc/sys/vm/overcommit_memory :)
跑ffmepg的时候,也会设置成1。避免ffmepg一些进程在申请内存的时候发生内部错误。
根本原因是进程申请了这么多memory,实际不一定占用这么多memory,而且物理内存页的分配发生在使用的瞬间,而不是在申请的瞬间。所以我们可以允许系统overcommit,满足进程申请,可以通过cgroup memory来限制用户使用内存的上限。
linux overcommit flag的更多相关文章
- Linux checksum flag in kernel
net_device->feature | NETIF_F_NO_CSUM: No need to use L4 checksum, it used for loopback device. | ...
- Linux malloc大内存的方法
本博文为原创,遵循CC3.0协议,转载请注明出处:http://blog.csdn.net/lux_veritas/article/details/9963199 ------------------ ...
- Linux 驱动开发
linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...
- 简化的nginx多进程模型demo
//version 1:以下代码仅演示nginx多进程模型[test@vm c]$ cat mynginx.c#include <stdio.h> #include <string. ...
- java操作Maven
记录瞬间 import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import ...
- C++ 判断目录是否存在并新建目录
http://blog.csdn.net/u012005313/article/details/50688257 #include <io.h> #include <string&g ...
- 攻防世界MISC新手练习
0x01 this_is_flag 对!!!这就是flag 0x02 ext3 题目提示是Linux光盘,附件下载下来 在linux中挂载mount linux /mnt 找一下flagtrings ...
- CTF -攻防世界-misc新手区
此题flag题目已经告诉格式,答案很简单. 将附件下载后,将光盘挂到虚拟机启动 使用 strings linux|grep flag会找到一个O7avZhikgKgbF/flag.txt然后root下 ...
- 在CTF比赛中,命令中空格被过滤的解决方法
1.linux {cat,flag.txt} cat${IFS}flag.txt cat$IFS$9flag.txt cat<flag.txt cat<>flag.txt kg=$' ...
随机推荐
- list.get(0)防止NPE
package com.chuangjin.p2p; import com.chuangjin.core.utils.JsonUtils; import java.util.ArrayList; im ...
- linux shell数组赋值方法(常用)
http://blog.csdn.net/shaobingj126/article/details/7395161 Bash中,数组变量的赋值有两种方法: (1) name = (value1 ... ...
- PCL安装
本文是在Ubuntu16.04下安装PCL. 按照官网的教程,有两种方法可以安装: 1.直接安装预先编译好的二进制库文件 sudo add-apt-repository ppa:v-launchpad ...
- ubuntu18.04静态ip设置
1.配置文件 vi /etc/netplan/-cloud-init.yaml network: ethernets: enp129s0f0: addresses: [] dhcp4: true op ...
- PHP中逻辑运算符的高效用法---&&和||
偶尔遇到这个,查了一下,所以就摘录了. 逻辑运算符无非是将值进行逻辑运算.还有其它用法吗?首先让我们先看一下下面的代码,然后我们再一起展开话题.提前给出结论就是(&&)or(||)”这 ...
- Codeforces Round #545 (Div. 2) D 贪心 + kmp
https://codeforces.com/contest/1138/problem/D 题意 两个01串s和t,s中字符能相互交换,问最多能得到多少个(可交叉)的t 题解 即将s中的01塞进t中, ...
- vue-element 动态单选多选全选
实现效果如图 数据格式如下: pps: [{"code":"6","createTime":"2018-09-07 00:00:0 ...
- 重装win10+ubuntu 双系统 UEFI启动模式
有较强的时效性!!先看一眼日期是否太古老! 任务 卸载双系统中的Ubuntu14,安装Ubuntu16 环境 操作系统: Win10 + Ubuntu14双系统 硬盘: 固态硬盘 + 机械硬盘,电脑的 ...
- c++中二级指针的使用场景
二级指针的使用场景如下: 1.主要用来为指针变量分配内存空间: void GetMemory(char **p) { *p = ]; } 函数调用方式: char *str = NULL; GetMe ...
- java解析json数据用到的jar包
百度云连接: https://pan.baidu.com/s/1iuQCc7uBO5XtAsNn6hwCew